statically/Dockerfile
Rick Barenthin 4ec37438b3
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
feat: inital version of a static webserver
2022-08-01 14:24:25 +02:00

31 lines
772 B
Docker

FROM alpine:3.16.0 AS builder
ARG THTTPD_VERSION=2.29
RUN apk add gcc musl-dev make
RUN wget http://www.acme.com/software/thttpd/thttpd-${THTTPD_VERSION}.tar.gz \
&& tar xzf thttpd-${THTTPD_VERSION}.tar.gz \
&& mv /thttpd-${THTTPD_VERSION} /thttpd
RUN cd /thttpd \
&& ./configure \
&& make CCOPT='-O2 -s -static' thttpd
RUN adduser -D www --home /var/www
FROM scratch
EXPOSE 3000
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /thttpd/thttpd /usr/local/bin/
USER www
WORKDIR /var/www/htdocs
# Copy the static website
# Use the .dockerignore file to control what ends up inside the image!
COPY . .
# Run thttpd
CMD ["/usr/local/bin/thttpd", "-D", "-h", "0.0.0.0", "-p", "3000", "-d", "/var/www/htdocs", "-u", "www", "-l", "-", "-M", "60"]