aligned_layer
aligned_layer copied to clipboard
fix(docker): Docker files do not have a `HEALTHCHECK` directive
Overview:
The Docker files used to build the project images in:
explorer/Dockerfiles
operator/docker/operator.Dockerfile
do not have a HEALTHCHECK directive.
Mitigation:
Use the HEALTHCHECK directive in the Dockerfiles to ensure that the containers are healthy and ready to
serve traffic.
For example with the explorer/Dockerfile
# https://hub.docker.com/_/postgres
FROM postgres:16.3
# Environment variables
ENV POSTGRES_USER=explorer_user
ENV POSTGRES_PASSWORD=explorer_pass
ENV POSTGRES_DB=explorer_db
# Expose the default PostgreSQL port
EXPOSE 5432
HEALTHCHECK --interval=5s --timeout=3s \
CMD pg_isready -U $POSTGRES_USER -d $POSTGRES_DB || exit 1