Adrià Vilanova MartÃnez | 619c557 | 2024-07-08 01:25:29 +0200 | [diff] [blame] | 1 | FROM alpine:3.20.1 AS builder |
| 2 | |
| 3 | ARG LIGHTTPD_TARBALL="https://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.76.tar.gz" |
| 4 | ARG LIGHTTPD_SHA256="ba14a030889518194fd88b33e419d51cc38c8fe917126d5a7a965be79b53e995" |
| 5 | |
| 6 | RUN set -eux; \ |
| 7 | \ |
| 8 | apk add --no-cache \ |
| 9 | bsd-compat-headers \ |
| 10 | build-base \ |
| 11 | pcre2-dev \ |
| 12 | scons |
| 13 | |
| 14 | RUN set -eux; \ |
| 15 | \ |
| 16 | wget -O lighttpd.tar.gz "$LIGHTTPD_TARBALL"; \ |
| 17 | echo "$LIGHTTPD_SHA256 *lighttpd.tar.gz" | sha256sum -c; \ |
| 18 | mkdir -p /usr/src/lighttpd; \ |
| 19 | tar -xzf lighttpd.tar.gz -C /usr/src/lighttpd --strip-components=1; \ |
| 20 | rm lighttpd.tar.gz; \ |
| 21 | cd /usr/src/lighttpd; \ |
| 22 | nproc="$(getconf _NPROCESSORS_ONLN)"; \ |
| 23 | eval "scons -j '$nproc' build_fullstatic=1 build_dynamic=0" |
| 24 | |
| 25 | RUN set -eux; \ |
| 26 | \ |
| 27 | mkdir -p /rootfs/bin; \ |
| 28 | cp /usr/src/lighttpd/sconsbuild/fullstatic/build/lighttpd /rootfs/bin/; \ |
| 29 | mkdir -p /rootfs/etc; \ |
| 30 | echo "nogroup:*:10001:nobody" > /rootfs/etc/group; \ |
| 31 | echo "nobody:*:10001:10001:::" > /rootfs/etc/passwd |
| 32 | |
| 33 | |
| 34 | FROM scratch |
| 35 | |
| 36 | COPY --from=builder --chown=10001:10001 /rootfs / |
| 37 | |
| 38 | USER 10001:10001 |
| 39 | |
| 40 | ENTRYPOINT ["/bin/lighttpd"] |
| 41 | CMD ["-D", "-f", "/lighttpd.conf"] |