Fossil SCM
Did away with the temporary src.tar.gz file in the new Docker container by streaming the output of wget straight into tar's stdin. This cuts the build time by about five seconds, presumably due to the saving from unnecessary file I/O. Also replaced the explicit "cd src" afterward with an out-of-tree build configuration, since it doesn't matter if we clutter the first stage's /tmp dir.
Commit
289c9b501cb724adafdfb3d4575d06ab5158b75cebb90421a71a928844c2874f
Parent
7bfd741355e24e6…
1 file changed
+10
-12
+10
-12
| --- Dockerfile | ||
| +++ Dockerfile | ||
| @@ -7,29 +7,27 @@ | ||
| 7 | 7 | # server instance on fossil-scm.org, which will keep these trunk |
| 8 | 8 | # tarballs around until the next trunk commit. |
| 9 | 9 | |
| 10 | 10 | FROM alpine:latest AS builder |
| 11 | 11 | WORKDIR /tmp |
| 12 | -RUN apk update \ | |
| 13 | - && apk upgrade --no-cache \ | |
| 14 | - && apk add --no-cache \ | |
| 15 | - busybox-static gcc make \ | |
| 16 | - musl-dev \ | |
| 17 | - openssl-dev openssl-libs-static \ | |
| 18 | - zlib-dev zlib-static \ | |
| 19 | - && wget https://fossil-scm.org/home/tarball/src.tar.gz \ | |
| 20 | - && tar -xf src.tar.gz \ | |
| 21 | - && cd src \ | |
| 22 | - && ./configure --static CFLAGS='-Os -s' \ | |
| 12 | +RUN apk update \ | |
| 13 | + && apk upgrade --no-cache \ | |
| 14 | + && apk add --no-cache \ | |
| 15 | + busybox-static gcc make \ | |
| 16 | + musl-dev \ | |
| 17 | + openssl-dev openssl-libs-static \ | |
| 18 | + zlib-dev zlib-static \ | |
| 19 | + && wget -O - https://fossil-scm.org/home/tarball/src | tar -xz \ | |
| 20 | + && src/configure --static CFLAGS='-Os -s' \ | |
| 23 | 21 | && make -j |
| 24 | 22 | |
| 25 | 23 | # STAGE 2: Pare that back to the bare essentials. |
| 26 | 24 | |
| 27 | 25 | FROM scratch |
| 28 | 26 | ENV JAIL=/jail |
| 29 | 27 | WORKDIR ${JAIL} |
| 30 | -COPY --from=builder /tmp/src/fossil ${JAIL}/bin/ | |
| 28 | +COPY --from=builder /tmp/fossil ${JAIL}/bin/ | |
| 31 | 29 | COPY --from=builder /bin/busybox.static /bin/busybox |
| 32 | 30 | RUN [ "/bin/busybox", "--install", "/bin" ] |
| 33 | 31 | RUN mkdir -m 700 dev \ |
| 34 | 32 | && mknod -m 600 dev/null c 1 3 \ |
| 35 | 33 | && mknod -m 600 dev/urandom c 1 9 |
| 36 | 34 |
| --- Dockerfile | |
| +++ Dockerfile | |
| @@ -7,29 +7,27 @@ | |
| 7 | # server instance on fossil-scm.org, which will keep these trunk |
| 8 | # tarballs around until the next trunk commit. |
| 9 | |
| 10 | FROM alpine:latest AS builder |
| 11 | WORKDIR /tmp |
| 12 | RUN apk update \ |
| 13 | && apk upgrade --no-cache \ |
| 14 | && apk add --no-cache \ |
| 15 | busybox-static gcc make \ |
| 16 | musl-dev \ |
| 17 | openssl-dev openssl-libs-static \ |
| 18 | zlib-dev zlib-static \ |
| 19 | && wget https://fossil-scm.org/home/tarball/src.tar.gz \ |
| 20 | && tar -xf src.tar.gz \ |
| 21 | && cd src \ |
| 22 | && ./configure --static CFLAGS='-Os -s' \ |
| 23 | && make -j |
| 24 | |
| 25 | # STAGE 2: Pare that back to the bare essentials. |
| 26 | |
| 27 | FROM scratch |
| 28 | ENV JAIL=/jail |
| 29 | WORKDIR ${JAIL} |
| 30 | COPY --from=builder /tmp/src/fossil ${JAIL}/bin/ |
| 31 | COPY --from=builder /bin/busybox.static /bin/busybox |
| 32 | RUN [ "/bin/busybox", "--install", "/bin" ] |
| 33 | RUN mkdir -m 700 dev \ |
| 34 | && mknod -m 600 dev/null c 1 3 \ |
| 35 | && mknod -m 600 dev/urandom c 1 9 |
| 36 |
| --- Dockerfile | |
| +++ Dockerfile | |
| @@ -7,29 +7,27 @@ | |
| 7 | # server instance on fossil-scm.org, which will keep these trunk |
| 8 | # tarballs around until the next trunk commit. |
| 9 | |
| 10 | FROM alpine:latest AS builder |
| 11 | WORKDIR /tmp |
| 12 | RUN apk update \ |
| 13 | && apk upgrade --no-cache \ |
| 14 | && apk add --no-cache \ |
| 15 | busybox-static gcc make \ |
| 16 | musl-dev \ |
| 17 | openssl-dev openssl-libs-static \ |
| 18 | zlib-dev zlib-static \ |
| 19 | && wget -O - https://fossil-scm.org/home/tarball/src | tar -xz \ |
| 20 | && src/configure --static CFLAGS='-Os -s' \ |
| 21 | && make -j |
| 22 | |
| 23 | # STAGE 2: Pare that back to the bare essentials. |
| 24 | |
| 25 | FROM scratch |
| 26 | ENV JAIL=/jail |
| 27 | WORKDIR ${JAIL} |
| 28 | COPY --from=builder /tmp/fossil ${JAIL}/bin/ |
| 29 | COPY --from=builder /bin/busybox.static /bin/busybox |
| 30 | RUN [ "/bin/busybox", "--install", "/bin" ] |
| 31 | RUN mkdir -m 700 dev \ |
| 32 | && mknod -m 600 dev/null c 1 3 \ |
| 33 | && mknod -m 600 dev/urandom c 1 9 |
| 34 |