Fossil SCM
Assorted cleanups to the Dockerfile: disentangled use of /tmp for building and creation of the eventual contents of /etc, dropped an unnecessary directory hierarchy level, removed an unused variable, whitespace fixes, etc. No functional change.
Commit
f9bd6273d914afaf5554311fe4dd5cf84c0e940cfc0506ce3045f5c8aa830cc0
Parent
4158e5e2a894cd8…
1 file changed
+20
-20
+20
-20
| --- Dockerfile | ||
| +++ Dockerfile | ||
| @@ -8,12 +8,12 @@ | ||
| 8 | 8 | ### We aren't pinning to a more stable version of Alpine because we want |
| 9 | 9 | ### to build with the latest tools and libraries available in case they |
| 10 | 10 | ### fixed something that matters to us since the last build. Everything |
| 11 | 11 | ### below depends on this layer, and so, alas, we toss this container's |
| 12 | 12 | ### cache on Alpine's release schedule, roughly once a month. |
| 13 | -FROM alpine:latest AS builder | |
| 14 | -WORKDIR /tmp | |
| 13 | +FROM alpine:latest AS bld | |
| 14 | +WORKDIR /fsl | |
| 15 | 15 | |
| 16 | 16 | ### Bake the basic Alpine Linux into a base layer so it only changes |
| 17 | 17 | ### when the upstream image is updated or we change the package set. |
| 18 | 18 | RUN set -x \ |
| 19 | 19 | && apk update \ |
| @@ -35,17 +35,17 @@ | ||
| 35 | 35 | ### by leveraging its DVCS nature via the "tarball" command and passing |
| 36 | 36 | ### the resulting file's name in. |
| 37 | 37 | ARG FSLCFG="" |
| 38 | 38 | ARG FSLVER="trunk" |
| 39 | 39 | ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}" |
| 40 | -ENV FSLSTB=/tmp/fsl/src.tar.gz | |
| 40 | +ENV FSLSTB=/fsl/src.tar.gz | |
| 41 | 41 | ADD $FSLURL $FSLSTB |
| 42 | 42 | RUN set -x \ |
| 43 | - && if [ -d $FSLSTB ] ; then mv $FSLSTB/src fsl ; \ | |
| 44 | - else tar -C fsl -xzf fsl/src.tar.gz ; fi \ | |
| 45 | - && m=fsl/src/src/main.mk \ | |
| 46 | - && fsl/src/configure --static CFLAGS='-Os -s' $FSLCFG && make -j11 | |
| 43 | + && if [ -d $FSLSTB ] ; \ | |
| 44 | + then mv $FSLSTB/src . ; \ | |
| 45 | + else tar -xf src.tar.gz ; fi \ | |
| 46 | + && src/configure --static CFLAGS='-Os -s' $FSLCFG && make -j16 | |
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | ## --------------------------------------------------------------------- |
| 50 | 50 | ## STAGE 2: Pare that back to the bare essentials. |
| 51 | 51 | ## --------------------------------------------------------------------- |
| @@ -54,28 +54,28 @@ | ||
| 54 | 54 | ARG UID=499 |
| 55 | 55 | |
| 56 | 56 | ### Set up that base OS for our specific use without tying it to |
| 57 | 57 | ### anything likely to change often. So long as the user leaves |
| 58 | 58 | ### UID alone, this layer will be durable. |
| 59 | -RUN set -x \ | |
| 60 | - && mkdir log museum \ | |
| 61 | - && echo "root:x:0:0:Admin:/:/false" > /tmp/passwd \ | |
| 62 | - && echo "root:x:0:root" > /tmp/group \ | |
| 63 | - && echo "fossil:x:${UID}:${UID}:User:/museum:/false" >> /tmp/passwd \ | |
| 64 | - && echo "fossil:x:${UID}:fossil" >> /tmp/group | |
| 59 | +RUN set -x \ | |
| 60 | + && mkdir e log museum \ | |
| 61 | + && echo "root:x:0:0:Admin:/:/false" > /e/passwd \ | |
| 62 | + && echo "root:x:0:root" > /e/group \ | |
| 63 | + && echo "fossil:x:${UID}:${UID}:User:/museum:/false" >> /e/passwd \ | |
| 64 | + && echo "fossil:x:${UID}:fossil" >> /e/group | |
| 65 | 65 | |
| 66 | 66 | |
| 67 | 67 | ## --------------------------------------------------------------------- |
| 68 | 68 | ## STAGE 3: Drop BusyBox, too, now that we're done with its /bin/sh &c |
| 69 | 69 | ## --------------------------------------------------------------------- |
| 70 | 70 | |
| 71 | 71 | FROM scratch AS run |
| 72 | -COPY --from=os /tmp/group /tmp/passwd /etc/ | |
| 73 | -COPY --from=os --chown=fossil:fossil /log /log/ | |
| 74 | -COPY --from=os --chown=fossil:fossil /museum /museum/ | |
| 75 | -COPY --from=os --chmod=1777 /tmp /tmp/ | |
| 76 | -COPY --from=builder /tmp/fossil /bin/ | |
| 72 | +COPY --from=bld --chmod=700 /fsl/fossil /bin/ | |
| 73 | +COPY --from=os --chmod=600 /e/* /etc/ | |
| 74 | +COPY --from=os --chmod=1777 /tmp /tmp/ | |
| 75 | +COPY --from=os --chown=fossil:fossil /log /log/ | |
| 76 | +COPY --from=os --chown=fossil:fossil /museum /museum/ | |
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | ## --------------------------------------------------------------------- |
| 80 | 80 | ## RUN! |
| 81 | 81 | ## --------------------------------------------------------------------- |
| @@ -82,9 +82,9 @@ | ||
| 82 | 82 | |
| 83 | 83 | ENV PATH "/bin" |
| 84 | 84 | EXPOSE 8080/tcp |
| 85 | 85 | USER fossil |
| 86 | 86 | ENTRYPOINT [ "fossil", "server", "museum/repo.fossil" ] |
| 87 | -CMD [ \ | |
| 87 | +CMD [ \ | |
| 88 | 88 | "--create", \ |
| 89 | 89 | "--jsmode", "bundled", \ |
| 90 | - "--user", "admin" ] | |
| 90 | + "--user", "admin" ] | |
| 91 | 91 |
| --- Dockerfile | |
| +++ Dockerfile | |
| @@ -8,12 +8,12 @@ | |
| 8 | ### We aren't pinning to a more stable version of Alpine because we want |
| 9 | ### to build with the latest tools and libraries available in case they |
| 10 | ### fixed something that matters to us since the last build. Everything |
| 11 | ### below depends on this layer, and so, alas, we toss this container's |
| 12 | ### cache on Alpine's release schedule, roughly once a month. |
| 13 | FROM alpine:latest AS builder |
| 14 | WORKDIR /tmp |
| 15 | |
| 16 | ### Bake the basic Alpine Linux into a base layer so it only changes |
| 17 | ### when the upstream image is updated or we change the package set. |
| 18 | RUN set -x \ |
| 19 | && apk update \ |
| @@ -35,17 +35,17 @@ | |
| 35 | ### by leveraging its DVCS nature via the "tarball" command and passing |
| 36 | ### the resulting file's name in. |
| 37 | ARG FSLCFG="" |
| 38 | ARG FSLVER="trunk" |
| 39 | ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}" |
| 40 | ENV FSLSTB=/tmp/fsl/src.tar.gz |
| 41 | ADD $FSLURL $FSLSTB |
| 42 | RUN set -x \ |
| 43 | && if [ -d $FSLSTB ] ; then mv $FSLSTB/src fsl ; \ |
| 44 | else tar -C fsl -xzf fsl/src.tar.gz ; fi \ |
| 45 | && m=fsl/src/src/main.mk \ |
| 46 | && fsl/src/configure --static CFLAGS='-Os -s' $FSLCFG && make -j11 |
| 47 | |
| 48 | |
| 49 | ## --------------------------------------------------------------------- |
| 50 | ## STAGE 2: Pare that back to the bare essentials. |
| 51 | ## --------------------------------------------------------------------- |
| @@ -54,28 +54,28 @@ | |
| 54 | ARG UID=499 |
| 55 | |
| 56 | ### Set up that base OS for our specific use without tying it to |
| 57 | ### anything likely to change often. So long as the user leaves |
| 58 | ### UID alone, this layer will be durable. |
| 59 | RUN set -x \ |
| 60 | && mkdir log museum \ |
| 61 | && echo "root:x:0:0:Admin:/:/false" > /tmp/passwd \ |
| 62 | && echo "root:x:0:root" > /tmp/group \ |
| 63 | && echo "fossil:x:${UID}:${UID}:User:/museum:/false" >> /tmp/passwd \ |
| 64 | && echo "fossil:x:${UID}:fossil" >> /tmp/group |
| 65 | |
| 66 | |
| 67 | ## --------------------------------------------------------------------- |
| 68 | ## STAGE 3: Drop BusyBox, too, now that we're done with its /bin/sh &c |
| 69 | ## --------------------------------------------------------------------- |
| 70 | |
| 71 | FROM scratch AS run |
| 72 | COPY --from=os /tmp/group /tmp/passwd /etc/ |
| 73 | COPY --from=os --chown=fossil:fossil /log /log/ |
| 74 | COPY --from=os --chown=fossil:fossil /museum /museum/ |
| 75 | COPY --from=os --chmod=1777 /tmp /tmp/ |
| 76 | COPY --from=builder /tmp/fossil /bin/ |
| 77 | |
| 78 | |
| 79 | ## --------------------------------------------------------------------- |
| 80 | ## RUN! |
| 81 | ## --------------------------------------------------------------------- |
| @@ -82,9 +82,9 @@ | |
| 82 | |
| 83 | ENV PATH "/bin" |
| 84 | EXPOSE 8080/tcp |
| 85 | USER fossil |
| 86 | ENTRYPOINT [ "fossil", "server", "museum/repo.fossil" ] |
| 87 | CMD [ \ |
| 88 | "--create", \ |
| 89 | "--jsmode", "bundled", \ |
| 90 | "--user", "admin" ] |
| 91 |
| --- Dockerfile | |
| +++ Dockerfile | |
| @@ -8,12 +8,12 @@ | |
| 8 | ### We aren't pinning to a more stable version of Alpine because we want |
| 9 | ### to build with the latest tools and libraries available in case they |
| 10 | ### fixed something that matters to us since the last build. Everything |
| 11 | ### below depends on this layer, and so, alas, we toss this container's |
| 12 | ### cache on Alpine's release schedule, roughly once a month. |
| 13 | FROM alpine:latest AS bld |
| 14 | WORKDIR /fsl |
| 15 | |
| 16 | ### Bake the basic Alpine Linux into a base layer so it only changes |
| 17 | ### when the upstream image is updated or we change the package set. |
| 18 | RUN set -x \ |
| 19 | && apk update \ |
| @@ -35,17 +35,17 @@ | |
| 35 | ### by leveraging its DVCS nature via the "tarball" command and passing |
| 36 | ### the resulting file's name in. |
| 37 | ARG FSLCFG="" |
| 38 | ARG FSLVER="trunk" |
| 39 | ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}" |
| 40 | ENV FSLSTB=/fsl/src.tar.gz |
| 41 | ADD $FSLURL $FSLSTB |
| 42 | RUN set -x \ |
| 43 | && if [ -d $FSLSTB ] ; \ |
| 44 | then mv $FSLSTB/src . ; \ |
| 45 | else tar -xf src.tar.gz ; fi \ |
| 46 | && src/configure --static CFLAGS='-Os -s' $FSLCFG && make -j16 |
| 47 | |
| 48 | |
| 49 | ## --------------------------------------------------------------------- |
| 50 | ## STAGE 2: Pare that back to the bare essentials. |
| 51 | ## --------------------------------------------------------------------- |
| @@ -54,28 +54,28 @@ | |
| 54 | ARG UID=499 |
| 55 | |
| 56 | ### Set up that base OS for our specific use without tying it to |
| 57 | ### anything likely to change often. So long as the user leaves |
| 58 | ### UID alone, this layer will be durable. |
| 59 | RUN set -x \ |
| 60 | && mkdir e log museum \ |
| 61 | && echo "root:x:0:0:Admin:/:/false" > /e/passwd \ |
| 62 | && echo "root:x:0:root" > /e/group \ |
| 63 | && echo "fossil:x:${UID}:${UID}:User:/museum:/false" >> /e/passwd \ |
| 64 | && echo "fossil:x:${UID}:fossil" >> /e/group |
| 65 | |
| 66 | |
| 67 | ## --------------------------------------------------------------------- |
| 68 | ## STAGE 3: Drop BusyBox, too, now that we're done with its /bin/sh &c |
| 69 | ## --------------------------------------------------------------------- |
| 70 | |
| 71 | FROM scratch AS run |
| 72 | COPY --from=bld --chmod=700 /fsl/fossil /bin/ |
| 73 | COPY --from=os --chmod=600 /e/* /etc/ |
| 74 | COPY --from=os --chmod=1777 /tmp /tmp/ |
| 75 | COPY --from=os --chown=fossil:fossil /log /log/ |
| 76 | COPY --from=os --chown=fossil:fossil /museum /museum/ |
| 77 | |
| 78 | |
| 79 | ## --------------------------------------------------------------------- |
| 80 | ## RUN! |
| 81 | ## --------------------------------------------------------------------- |
| @@ -82,9 +82,9 @@ | |
| 82 | |
| 83 | ENV PATH "/bin" |
| 84 | EXPOSE 8080/tcp |
| 85 | USER fossil |
| 86 | ENTRYPOINT [ "fossil", "server", "museum/repo.fossil" ] |
| 87 | CMD [ \ |
| 88 | "--create", \ |
| 89 | "--jsmode", "bundled", \ |
| 90 | "--user", "admin" ] |
| 91 |