Skip to content

Commit

Permalink
Add healthcheck to web container
Browse files Browse the repository at this point in the history
  • Loading branch information
baschny committed May 9, 2023
1 parent 52131b1 commit f7ceb60
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
FROM httpd:2.4

# We will need openssl tool for the entrypoint
RUN apt-get -qq update && apt-get -q install -y openssl && rm -rf /var/lib/apt/lists/*
RUN apt-get -qq update && apt-get -q install -y openssl netcat && rm -rf /var/lib/apt/lists/*

# Prepare our apache configuration
RUN rm /usr/local/apache2/conf/extra/httpd-vhosts.conf /usr/local/apache2/conf/original/extra/httpd-ssl.conf
Expand All @@ -16,6 +16,9 @@ RUN chmod 644 /usr/local/apache2/conf/httpd.conf /usr/local/apache2/conf/extra/h
COPY files/entrypoint.sh /
RUN chmod 755 /entrypoint.sh

# Configure healthcheck - use "nc" to see if port 80 is open, because curl might still get errors (403, etc)
HEALTHCHECK --interval=5s --timeout=3s CMD nc -z -v localhost 80 || exit 1

# Also expose SSL port
EXPOSE 80 443

Expand Down

0 comments on commit f7ceb60

Please sign in to comment.