added HELATHCHECK
nclazz/static-webserver-docker/pipeline/head This commit looks good Details

master
Niclas Thobaben 2022-02-10 19:54:26 +01:00
parent 82c09aac4a
commit 98c8816fc1
1 changed files with 9 additions and 1 deletions

View File

@ -3,7 +3,7 @@ FROM alpine:3.15.0 AS builder
ARG THTTPD_VERSION=2.29
# Install all dependencies required for compiling thttpd
RUN apk add gcc musl-dev make
RUN apk add gcc musl-dev make curl
# Download thttpd sources
RUN wget http://www.acme.com/software/thttpd/thttpd-${THTTPD_VERSION}.tar.gz \
@ -29,6 +29,9 @@ COPY --from=builder /etc/passwd /etc/passwd
# Copy the thttpd static binary
COPY --from=builder /thttpd/thttpd /
# Copy the thttpd static binary
COPY --from=builder /usr/bin/curl /
# Use our non-root user
USER static
WORKDIR /home/static
@ -39,5 +42,10 @@ COPY . .
ENV MAX_AGE=60
HEALTHCHECK --interval=30s --timeout=30s --retries=3 \
CMD /curl http://localhost:80 || exit 1
# Run thttpd
CMD ["/thttpd", "-D", "-h", "0.0.0.0", "-p", "80", "-d", "/home/static", "-u", "static", "-l", "-", "-M", "${MAX_AGE}"]