FROM nginx:stable-alpine # Copy custom Nginx configuration if needed # COPY ./nginx.conf /etc/nginx/nginx.conf # Expose the port your application listens on EXPOSE 80 # Define a health check for the container # This tells Docker if the container is healthy and ready to serve requests. # --interval: how often to run the check (default: 30s) # --timeout: how long to wait for a command to complete (default: 30s) # --start-period: graceful startup period during which health check failures won't count (default: 0s) # --retries: how many consecutive failures before considering container 'unhealthy' (default: 3) HEALTHCHECK --interval=5s --timeout=3s --start-period=5s --retries=3 \ CMD wget --quiet --tries=1 --spider http://localhost/ || exit 1 CMD ["nginx", "-g", "daemon off;"]