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"]