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.

wyoung 2023-05-06 19:04 trunk
Commit f9bd6273d914afaf5554311fe4dd5cf84c0e940cfc0506ce3045f5c8aa830cc0
1 file changed +20 -20
+20 -20
--- Dockerfile
+++ Dockerfile
@@ -8,12 +8,12 @@
88
### We aren't pinning to a more stable version of Alpine because we want
99
### to build with the latest tools and libraries available in case they
1010
### fixed something that matters to us since the last build. Everything
1111
### below depends on this layer, and so, alas, we toss this container's
1212
### 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
1515
1616
### Bake the basic Alpine Linux into a base layer so it only changes
1717
### when the upstream image is updated or we change the package set.
1818
RUN set -x \
1919
&& apk update \
@@ -35,17 +35,17 @@
3535
### by leveraging its DVCS nature via the "tarball" command and passing
3636
### the resulting file's name in.
3737
ARG FSLCFG=""
3838
ARG FSLVER="trunk"
3939
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
4141
ADD $FSLURL $FSLSTB
4242
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
4747
4848
4949
## ---------------------------------------------------------------------
5050
## STAGE 2: Pare that back to the bare essentials.
5151
## ---------------------------------------------------------------------
@@ -54,28 +54,28 @@
5454
ARG UID=499
5555
5656
### Set up that base OS for our specific use without tying it to
5757
### anything likely to change often. So long as the user leaves
5858
### 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
6565
6666
6767
## ---------------------------------------------------------------------
6868
## STAGE 3: Drop BusyBox, too, now that we're done with its /bin/sh &c
6969
## ---------------------------------------------------------------------
7070
7171
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/
7777
7878
7979
## ---------------------------------------------------------------------
8080
## RUN!
8181
## ---------------------------------------------------------------------
@@ -82,9 +82,9 @@
8282
8383
ENV PATH "/bin"
8484
EXPOSE 8080/tcp
8585
USER fossil
8686
ENTRYPOINT [ "fossil", "server", "museum/repo.fossil" ]
87
-CMD [ \
87
+CMD [ \
8888
"--create", \
8989
"--jsmode", "bundled", \
90
- "--user", "admin" ]
90
+ "--user", "admin" ]
9191
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button