Fossil SCM

Using "FROM busybox" in the second stage of the Dockerfile instead of "FROM scratch" plus a copy of the busybox.static binary installed via APK in the first stage. We're throwing this layer away in the third stage, so the difference is immaterial. This simplifies things without losing anything we care about.

wyoung 2023-03-28 13:29 trunk
Commit cda5d6a72bafd8523c0b1d42665097709bd5a5d710f8e39e8603d942e8fe9795
1 file changed +3 -8
+3 -8
--- Dockerfile
+++ Dockerfile
@@ -17,11 +17,11 @@
1717
### when the upstream image is updated or we change the package set.
1818
RUN set -x \
1919
&& apk update \
2020
&& apk upgrade --no-cache \
2121
&& apk add --no-cache \
22
- busybox-static gcc make \
22
+ gcc make \
2323
linux-headers musl-dev \
2424
openssl-dev openssl-libs-static \
2525
zlib-dev zlib-static
2626
2727
### Build Fossil as a separate layer so we don't have to rebuild the
@@ -48,23 +48,18 @@
4848
4949
## ---------------------------------------------------------------------
5050
## STAGE 2: Pare that back to the bare essentials.
5151
## ---------------------------------------------------------------------
5252
53
-FROM scratch AS os
53
+FROM busybox AS os
5454
ARG UID=499
5555
56
-### Lay BusyBox down as the first base layer. Coupled with the host's
57
-### kernel, this is the "OS" used to RUN the subsequent setup script.
58
-COPY --from=builder /bin/busybox.static /bin/busybox
59
-RUN [ "/bin/busybox", "--install", "/bin" ]
60
-
6156
### Set up that base OS for our specific use without tying it to
6257
### anything likely to change often. So long as the user leaves
6358
### UID alone, this layer will be durable.
6459
RUN set -x \
65
- && mkdir log museum tmp \
60
+ && mkdir log museum \
6661
&& echo "root:x:0:0:Admin:/:/false" > /tmp/passwd \
6762
&& echo "root:x:0:root" > /tmp/group \
6863
&& echo "fossil:x:${UID}:${UID}:User:/museum:/false" >> /tmp/passwd \
6964
&& echo "fossil:x:${UID}:fossil" >> /tmp/group
7065
7166
--- Dockerfile
+++ Dockerfile
@@ -17,11 +17,11 @@
17 ### when the upstream image is updated or we change the package set.
18 RUN set -x \
19 && apk update \
20 && apk upgrade --no-cache \
21 && apk add --no-cache \
22 busybox-static gcc make \
23 linux-headers musl-dev \
24 openssl-dev openssl-libs-static \
25 zlib-dev zlib-static
26
27 ### Build Fossil as a separate layer so we don't have to rebuild the
@@ -48,23 +48,18 @@
48
49 ## ---------------------------------------------------------------------
50 ## STAGE 2: Pare that back to the bare essentials.
51 ## ---------------------------------------------------------------------
52
53 FROM scratch AS os
54 ARG UID=499
55
56 ### Lay BusyBox down as the first base layer. Coupled with the host's
57 ### kernel, this is the "OS" used to RUN the subsequent setup script.
58 COPY --from=builder /bin/busybox.static /bin/busybox
59 RUN [ "/bin/busybox", "--install", "/bin" ]
60
61 ### Set up that base OS for our specific use without tying it to
62 ### anything likely to change often. So long as the user leaves
63 ### UID alone, this layer will be durable.
64 RUN set -x \
65 && mkdir log museum tmp \
66 && echo "root:x:0:0:Admin:/:/false" > /tmp/passwd \
67 && echo "root:x:0:root" > /tmp/group \
68 && echo "fossil:x:${UID}:${UID}:User:/museum:/false" >> /tmp/passwd \
69 && echo "fossil:x:${UID}:fossil" >> /tmp/group
70
71
--- Dockerfile
+++ Dockerfile
@@ -17,11 +17,11 @@
17 ### when the upstream image is updated or we change the package set.
18 RUN set -x \
19 && apk update \
20 && apk upgrade --no-cache \
21 && apk add --no-cache \
22 gcc make \
23 linux-headers musl-dev \
24 openssl-dev openssl-libs-static \
25 zlib-dev zlib-static
26
27 ### Build Fossil as a separate layer so we don't have to rebuild the
@@ -48,23 +48,18 @@
48
49 ## ---------------------------------------------------------------------
50 ## STAGE 2: Pare that back to the bare essentials.
51 ## ---------------------------------------------------------------------
52
53 FROM busybox AS os
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

Keyboard Shortcuts

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