Fossil SCM

Carved the Docker container image size down still further by stripping out all but two of the stock skins (d* so we get default and darkmode) and packing Fossil and BusyBox with UPX.

wyoung 2022-08-16 07:03 trunk
Commit e20d044cc009a6db884f34a0599920c5e33759fb23d9aa8401cb0a8faefc7371
+3 -2
--- Dockerfile.in
+++ Dockerfile.in
@@ -10,19 +10,20 @@
1010
ADD $FSLURL /tmp/fsl/src.tar.gz
1111
WORKDIR /tmp
1212
RUN apk update \
1313
&& apk upgrade --no-cache \
1414
&& apk add --no-cache \
15
- gcc make \
15
+ gcc make moreutils upx \
1616
linux-headers musl-dev \
1717
openssl-dev openssl-libs-static \
1818
zlib-dev zlib-static \
1919
&& tar --strip-components=1 -C bbx -xzf bbx/src.tar.gz \
2020
&& ( cd bbx && yes "" | make oldconfig && make -j ) \
2121
&& tar -C fsl -xzf fsl/src.tar.gz \
22
+ && m=fsl/src/main.mk ; grep -v '/skins/[a-ce-z]' $m | sponge $m \
2223
&& fsl/configure --static CFLAGS='-Os -s' \
23
- && make -j
24
+ && make -j && upx -9 fossil bbx/busybox
2425
2526
# STAGE 2: Pare that back to the bare essentials.
2627
2728
FROM scratch
2829
WORKDIR /jail
2930
--- Dockerfile.in
+++ Dockerfile.in
@@ -10,19 +10,20 @@
10 ADD $FSLURL /tmp/fsl/src.tar.gz
11 WORKDIR /tmp
12 RUN apk update \
13 && apk upgrade --no-cache \
14 && apk add --no-cache \
15 gcc make \
16 linux-headers musl-dev \
17 openssl-dev openssl-libs-static \
18 zlib-dev zlib-static \
19 && tar --strip-components=1 -C bbx -xzf bbx/src.tar.gz \
20 && ( cd bbx && yes "" | make oldconfig && make -j ) \
21 && tar -C fsl -xzf fsl/src.tar.gz \
 
22 && fsl/configure --static CFLAGS='-Os -s' \
23 && make -j
24
25 # STAGE 2: Pare that back to the bare essentials.
26
27 FROM scratch
28 WORKDIR /jail
29
--- Dockerfile.in
+++ Dockerfile.in
@@ -10,19 +10,20 @@
10 ADD $FSLURL /tmp/fsl/src.tar.gz
11 WORKDIR /tmp
12 RUN apk update \
13 && apk upgrade --no-cache \
14 && apk add --no-cache \
15 gcc make moreutils upx \
16 linux-headers musl-dev \
17 openssl-dev openssl-libs-static \
18 zlib-dev zlib-static \
19 && tar --strip-components=1 -C bbx -xzf bbx/src.tar.gz \
20 && ( cd bbx && yes "" | make oldconfig && make -j ) \
21 && tar -C fsl -xzf fsl/src.tar.gz \
22 && m=fsl/src/main.mk ; grep -v '/skins/[a-ce-z]' $m | sponge $m \
23 && fsl/configure --static CFLAGS='-Os -s' \
24 && make -j && upx -9 fossil bbx/busybox
25
26 # STAGE 2: Pare that back to the bare essentials.
27
28 FROM scratch
29 WORKDIR /jail
30
+2 -1
--- www/build.wiki
+++ www/build.wiki
@@ -270,11 +270,12 @@
270270
internally, then remap it to wherever you want it on the host instead.
271271
272272
Our stock <tt>Dockerfile</tt> configures Fossil with the default feature
273273
set, so you may wish to modify the <tt>Dockerfile</tt> to add
274274
configuration options, add APK packages to support those options, and so
275
-forth.
275
+forth. It also strips out all but the default and darkmode skins to save
276
+executable space.
276277
277278
There are two convenience targets for you, <tt>make container-image</tt>
278279
and <tt>make container-run</tt>. The first creates a versioned container
279280
image, and the second does that and then launches a fresh container
280281
based on that image. You can pass extra arguments to the first command
281282
--- www/build.wiki
+++ www/build.wiki
@@ -270,11 +270,12 @@
270 internally, then remap it to wherever you want it on the host instead.
271
272 Our stock <tt>Dockerfile</tt> configures Fossil with the default feature
273 set, so you may wish to modify the <tt>Dockerfile</tt> to add
274 configuration options, add APK packages to support those options, and so
275 forth.
 
276
277 There are two convenience targets for you, <tt>make container-image</tt>
278 and <tt>make container-run</tt>. The first creates a versioned container
279 image, and the second does that and then launches a fresh container
280 based on that image. You can pass extra arguments to the first command
281
--- www/build.wiki
+++ www/build.wiki
@@ -270,11 +270,12 @@
270 internally, then remap it to wherever you want it on the host instead.
271
272 Our stock <tt>Dockerfile</tt> configures Fossil with the default feature
273 set, so you may wish to modify the <tt>Dockerfile</tt> to add
274 configuration options, add APK packages to support those options, and so
275 forth. It also strips out all but the default and darkmode skins to save
276 executable space.
277
278 There are two convenience targets for you, <tt>make container-image</tt>
279 and <tt>make container-run</tt>. The first creates a versioned container
280 image, and the second does that and then launches a fresh container
281 based on that image. You can pass extra arguments to the first command
282
--- www/fossil-v-git.wiki
+++ www/fossil-v-git.wiki
@@ -180,13 +180,14 @@
180180
181181
This policy is particularly useful when running Fossil inside a
182182
restrictive container, anything from [./chroot.md | classic chroot
183183
jails] to modern [https://en.wikipedia.org/wiki/OS-level_virtualization
184184
| OS-level virtualization mechanisms] such as
185
-[https://en.wikipedia.org/wiki/Docker_(software) | Docker]. Our
185
+[https://en.wikipedia.org/wiki/Docker_(software) | Docker]. By using
186
+executable compression, our
186187
[/file?name=Dockerfile&ci=trunk | stock <tt>Dockerfile</tt>]
187
-creates a container that's under 8 MiB on 64-bit Linux, including
188
+creates a container that's under 4 MiB on 64-bit Linux, including
188189
a capable [https://www.busybox.net/ | Busybox] environment for live
189190
debugging of the container's innards.
190191
191192
Modern Linux systems tend to make full static linking
192193
[https://stackoverflow.com/questions/3430400/linux-static-linking-is-dead
193194
--- www/fossil-v-git.wiki
+++ www/fossil-v-git.wiki
@@ -180,13 +180,14 @@
180
181 This policy is particularly useful when running Fossil inside a
182 restrictive container, anything from [./chroot.md | classic chroot
183 jails] to modern [https://en.wikipedia.org/wiki/OS-level_virtualization
184 | OS-level virtualization mechanisms] such as
185 [https://en.wikipedia.org/wiki/Docker_(software) | Docker]. Our
 
186 [/file?name=Dockerfile&ci=trunk | stock <tt>Dockerfile</tt>]
187 creates a container that's under 8 MiB on 64-bit Linux, including
188 a capable [https://www.busybox.net/ | Busybox] environment for live
189 debugging of the container's innards.
190
191 Modern Linux systems tend to make full static linking
192 [https://stackoverflow.com/questions/3430400/linux-static-linking-is-dead
193
--- www/fossil-v-git.wiki
+++ www/fossil-v-git.wiki
@@ -180,13 +180,14 @@
180
181 This policy is particularly useful when running Fossil inside a
182 restrictive container, anything from [./chroot.md | classic chroot
183 jails] to modern [https://en.wikipedia.org/wiki/OS-level_virtualization
184 | OS-level virtualization mechanisms] such as
185 [https://en.wikipedia.org/wiki/Docker_(software) | Docker]. By using
186 executable compression, our
187 [/file?name=Dockerfile&ci=trunk | stock <tt>Dockerfile</tt>]
188 creates a container that's under 4 MiB on 64-bit Linux, including
189 a capable [https://www.busybox.net/ | Busybox] environment for live
190 debugging of the container's innards.
191
192 Modern Linux systems tend to make full static linking
193 [https://stackoverflow.com/questions/3430400/linux-static-linking-is-dead
194

Keyboard Shortcuts

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