aligned_layer icon indicating copy to clipboard operation
aligned_layer copied to clipboard

fix(docker): Docker files do not have a `HEALTHCHECK` directive

Open PatStiles opened this issue 1 year ago • 0 comments

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

References

PatStiles avatar Sep 19 '24 15:09 PatStiles