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.
Commit
e20d044cc009a6db884f34a0599920c5e33759fb23d9aa8401cb0a8faefc7371
Parent
7ecd23e0efde0d3…
3 files changed
+3
-2
+2
-1
+3
-2
+3
-2
| --- Dockerfile.in | ||
| +++ Dockerfile.in | ||
| @@ -10,19 +10,20 @@ | ||
| 10 | 10 | ADD $FSLURL /tmp/fsl/src.tar.gz |
| 11 | 11 | WORKDIR /tmp |
| 12 | 12 | RUN apk update \ |
| 13 | 13 | && apk upgrade --no-cache \ |
| 14 | 14 | && apk add --no-cache \ |
| 15 | - gcc make \ | |
| 15 | + gcc make moreutils upx \ | |
| 16 | 16 | linux-headers musl-dev \ |
| 17 | 17 | openssl-dev openssl-libs-static \ |
| 18 | 18 | zlib-dev zlib-static \ |
| 19 | 19 | && tar --strip-components=1 -C bbx -xzf bbx/src.tar.gz \ |
| 20 | 20 | && ( cd bbx && yes "" | make oldconfig && make -j ) \ |
| 21 | 21 | && tar -C fsl -xzf fsl/src.tar.gz \ |
| 22 | + && m=fsl/src/main.mk ; grep -v '/skins/[a-ce-z]' $m | sponge $m \ | |
| 22 | 23 | && fsl/configure --static CFLAGS='-Os -s' \ |
| 23 | - && make -j | |
| 24 | + && make -j && upx -9 fossil bbx/busybox | |
| 24 | 25 | |
| 25 | 26 | # STAGE 2: Pare that back to the bare essentials. |
| 26 | 27 | |
| 27 | 28 | FROM scratch |
| 28 | 29 | WORKDIR /jail |
| 29 | 30 |
| --- 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 @@ | ||
| 270 | 270 | internally, then remap it to wherever you want it on the host instead. |
| 271 | 271 | |
| 272 | 272 | Our stock <tt>Dockerfile</tt> configures Fossil with the default feature |
| 273 | 273 | set, so you may wish to modify the <tt>Dockerfile</tt> to add |
| 274 | 274 | 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. | |
| 276 | 277 | |
| 277 | 278 | There are two convenience targets for you, <tt>make container-image</tt> |
| 278 | 279 | and <tt>make container-run</tt>. The first creates a versioned container |
| 279 | 280 | image, and the second does that and then launches a fresh container |
| 280 | 281 | based on that image. You can pass extra arguments to the first command |
| 281 | 282 |
| --- 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 |
+3
-2
| --- www/fossil-v-git.wiki | ||
| +++ www/fossil-v-git.wiki | ||
| @@ -180,13 +180,14 @@ | ||
| 180 | 180 | |
| 181 | 181 | This policy is particularly useful when running Fossil inside a |
| 182 | 182 | restrictive container, anything from [./chroot.md | classic chroot |
| 183 | 183 | jails] to modern [https://en.wikipedia.org/wiki/OS-level_virtualization |
| 184 | 184 | | 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 | |
| 186 | 187 | [/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 | |
| 188 | 189 | a capable [https://www.busybox.net/ | Busybox] environment for live |
| 189 | 190 | debugging of the container's innards. |
| 190 | 191 | |
| 191 | 192 | Modern Linux systems tend to make full static linking |
| 192 | 193 | [https://stackoverflow.com/questions/3430400/linux-static-linking-is-dead |
| 193 | 194 |
| --- 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 |