Fossil SCM
Added the FSLCFG Dockerfile build arg and showed how to use it in the containers doc, plus other improvements to the doc while in there.
Commit
e2277aad160f11fbcc6b6938ac9884cff0eb27dfce17768589ca4c11b7f072f7
Parent
4429e10f6d25966…
2 files changed
+7
-6
+31
-8
+7
-6
| --- Dockerfile | ||
| +++ Dockerfile | ||
| @@ -29,12 +29,12 @@ | ||
| 29 | 29 | ARG BBXVER="1_35_0" |
| 30 | 30 | ENV BBXURL "https://github.com/mirror/busybox/tarball/${BBXVER}" |
| 31 | 31 | COPY containers/busybox-config /tmp/bbx/.config |
| 32 | 32 | ADD $BBXURL /tmp/bbx/src.tar.gz |
| 33 | 33 | RUN set -x \ |
| 34 | - && tar --strip-components=1 -C bbx -xzf bbx/src.tar.gz \ | |
| 35 | - && ( cd bbx && yes "" | make oldconfig && make -j11 ) \ | |
| 34 | + && tar --strip-components=1 -C bbx -xzf bbx/src.tar.gz \ | |
| 35 | + && ( cd bbx && yes "" | make oldconfig && make -j11 ) \ | |
| 36 | 36 | && test ! -x /usr/bin/upx || upx -9q bbx/busybox |
| 37 | 37 | |
| 38 | 38 | ### The changeable Fossil layer is the only one in the first stage that |
| 39 | 39 | ### changes often, so add it last, to make it independent of the others. |
| 40 | 40 | ### |
| @@ -43,19 +43,20 @@ | ||
| 43 | 43 | ### from a URL! It matters because we default to a URL in case you're |
| 44 | 44 | ### building outside a Fossil checkout, but when building via the |
| 45 | 45 | ### container-image target, we can avoid a costly hit on the Fossil |
| 46 | 46 | ### project's home site by pulling the data from the local repo via the |
| 47 | 47 | ### "tarball" command. This is a DVCS, after all! |
| 48 | +ARG FSLCFG="" | |
| 48 | 49 | ARG FSLVER="trunk" |
| 49 | 50 | ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}" |
| 50 | 51 | ENV FSLSTB=/tmp/fsl/src.tar.gz |
| 51 | 52 | ADD $FSLURL $FSLSTB |
| 52 | 53 | RUN set -x \ |
| 53 | - && if [ -d $FSLSTB ] ; then mv $FSLSTB/src fsl ; \ | |
| 54 | - else tar -C fsl -xzf fsl/src.tar.gz ; fi \ | |
| 55 | - && m=fsl/src/src/main.mk \ | |
| 56 | - && fsl/src/configure --static CFLAGS='-Os -s' && make -j11 \ | |
| 54 | + && if [ -d $FSLSTB ] ; then mv $FSLSTB/src fsl ; \ | |
| 55 | + else tar -C fsl -xzf fsl/src.tar.gz ; fi \ | |
| 56 | + && m=fsl/src/src/main.mk \ | |
| 57 | + && fsl/src/configure --static CFLAGS='-Os -s' $FSLCFG && make -j11 \ | |
| 57 | 58 | && if [ -x /usr/bin/upx ] ; then upx -9q fossil ; fi |
| 58 | 59 | |
| 59 | 60 | |
| 60 | 61 | ## --------------------------------------------------------------------- |
| 61 | 62 | ## STAGE 2: Pare that back to the bare essentials. |
| 62 | 63 |
| --- Dockerfile | |
| +++ Dockerfile | |
| @@ -29,12 +29,12 @@ | |
| 29 | ARG BBXVER="1_35_0" |
| 30 | ENV BBXURL "https://github.com/mirror/busybox/tarball/${BBXVER}" |
| 31 | COPY containers/busybox-config /tmp/bbx/.config |
| 32 | ADD $BBXURL /tmp/bbx/src.tar.gz |
| 33 | RUN set -x \ |
| 34 | && tar --strip-components=1 -C bbx -xzf bbx/src.tar.gz \ |
| 35 | && ( cd bbx && yes "" | make oldconfig && make -j11 ) \ |
| 36 | && test ! -x /usr/bin/upx || upx -9q bbx/busybox |
| 37 | |
| 38 | ### The changeable Fossil layer is the only one in the first stage that |
| 39 | ### changes often, so add it last, to make it independent of the others. |
| 40 | ### |
| @@ -43,19 +43,20 @@ | |
| 43 | ### from a URL! It matters because we default to a URL in case you're |
| 44 | ### building outside a Fossil checkout, but when building via the |
| 45 | ### container-image target, we can avoid a costly hit on the Fossil |
| 46 | ### project's home site by pulling the data from the local repo via the |
| 47 | ### "tarball" command. This is a DVCS, after all! |
| 48 | ARG FSLVER="trunk" |
| 49 | ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}" |
| 50 | ENV FSLSTB=/tmp/fsl/src.tar.gz |
| 51 | ADD $FSLURL $FSLSTB |
| 52 | RUN set -x \ |
| 53 | && if [ -d $FSLSTB ] ; then mv $FSLSTB/src fsl ; \ |
| 54 | else tar -C fsl -xzf fsl/src.tar.gz ; fi \ |
| 55 | && m=fsl/src/src/main.mk \ |
| 56 | && fsl/src/configure --static CFLAGS='-Os -s' && make -j11 \ |
| 57 | && if [ -x /usr/bin/upx ] ; then upx -9q fossil ; fi |
| 58 | |
| 59 | |
| 60 | ## --------------------------------------------------------------------- |
| 61 | ## STAGE 2: Pare that back to the bare essentials. |
| 62 |
| --- Dockerfile | |
| +++ Dockerfile | |
| @@ -29,12 +29,12 @@ | |
| 29 | ARG BBXVER="1_35_0" |
| 30 | ENV BBXURL "https://github.com/mirror/busybox/tarball/${BBXVER}" |
| 31 | COPY containers/busybox-config /tmp/bbx/.config |
| 32 | ADD $BBXURL /tmp/bbx/src.tar.gz |
| 33 | RUN set -x \ |
| 34 | && tar --strip-components=1 -C bbx -xzf bbx/src.tar.gz \ |
| 35 | && ( cd bbx && yes "" | make oldconfig && make -j11 ) \ |
| 36 | && test ! -x /usr/bin/upx || upx -9q bbx/busybox |
| 37 | |
| 38 | ### The changeable Fossil layer is the only one in the first stage that |
| 39 | ### changes often, so add it last, to make it independent of the others. |
| 40 | ### |
| @@ -43,19 +43,20 @@ | |
| 43 | ### from a URL! It matters because we default to a URL in case you're |
| 44 | ### building outside a Fossil checkout, but when building via the |
| 45 | ### container-image target, we can avoid a costly hit on the Fossil |
| 46 | ### project's home site by pulling the data from the local repo via the |
| 47 | ### "tarball" command. This is a DVCS, after all! |
| 48 | ARG FSLCFG="" |
| 49 | ARG FSLVER="trunk" |
| 50 | ARG FSLURL="https://fossil-scm.org/home/tarball/src?r=${FSLVER}" |
| 51 | ENV FSLSTB=/tmp/fsl/src.tar.gz |
| 52 | ADD $FSLURL $FSLSTB |
| 53 | RUN set -x \ |
| 54 | && if [ -d $FSLSTB ] ; then mv $FSLSTB/src fsl ; \ |
| 55 | else tar -C fsl -xzf fsl/src.tar.gz ; fi \ |
| 56 | && m=fsl/src/src/main.mk \ |
| 57 | && fsl/src/configure --static CFLAGS='-Os -s' $FSLCFG && make -j11 \ |
| 58 | && if [ -x /usr/bin/upx ] ; then upx -9q fossil ; fi |
| 59 | |
| 60 | |
| 61 | ## --------------------------------------------------------------------- |
| 62 | ## STAGE 2: Pare that back to the bare essentials. |
| 63 |
+31
-8
| --- www/containers.md | ||
| +++ www/containers.md | ||
| @@ -392,24 +392,33 @@ | ||
| 392 | 392 | don’t blindly update the BusyBox version merely because a new release |
| 393 | 393 | came out. Someone needs to get around to vetting it against our stock |
| 394 | 394 | configuration first. |
| 395 | 395 | |
| 396 | 396 | As for Fossil, it defaults to fetching the same version as the checkout |
| 397 | -you’re running the build command from, based on checkin ID. The most | |
| 398 | -common reason to override this is to get a release version: | |
| 397 | +you’re running the build command from, based on checkin ID. You could | |
| 398 | +use this to get a release build, for instance: | |
| 399 | 399 | |
| 400 | 400 | ``` |
| 401 | 401 | $ docker build -t fossil \ |
| 402 | - --build-arg FSLVER=version-2.19 . | |
| 402 | + --build-arg FSLVER=version-2.20 . | |
| 403 | +``` | |
| 404 | + | |
| 405 | +Or equivalently, using Fossil’s `Makefile` convenience target: | |
| 406 | + | |
| 407 | +``` | |
| 408 | + $ make container-image \ | |
| 409 | + DBFLAGS='--build-arg FSLVER=version-2.20' | |
| 403 | 410 | ``` |
| 404 | 411 | |
| 405 | -It’s best to use a specific version number rather than the generic | |
| 406 | -“`release`” tag because Docker caches downloaded files and tries to | |
| 412 | +While you could instead use the generic | |
| 413 | +“`release`” tag here, it’s better to use a specific version number | |
| 414 | +since Docker caches downloaded files and tries to | |
| 407 | 415 | reuse them across builds. If you ask for “`release`” before a new |
| 408 | 416 | version is tagged and then immediately after, you might expect to get |
| 409 | -two different tarballs, but because the URL hasn’t changed, if you have | |
| 410 | -an old release tarball in your Docker cache, you’ll get the old version | |
| 417 | +two different tarballs, but because the underlying source tarball URL | |
| 418 | +remains the same when you do that, you’ll end up reusing the | |
| 419 | +old tarball from your Docker cache. This will occur | |
| 411 | 420 | even if you pass the “`docker build --no-cache`” option. |
| 412 | 421 | |
| 413 | 422 | This is why we default to pulling the Fossil tarball by checkin ID |
| 414 | 423 | rather than let it default to the generic “`trunk`” tag: so the URL will |
| 415 | 424 | change each time you update your Fossil source tree, forcing Docker to |
| @@ -426,18 +435,32 @@ | ||
| 426 | 435 | close to zero as we can manage. |
| 427 | 436 | |
| 428 | 437 | To change it to something else, say: |
| 429 | 438 | |
| 430 | 439 | ``` |
| 431 | - $ docker build -t fossil --build-arg UID=501 . | |
| 440 | + $ make container-image \ | |
| 441 | + DBFLAGS='--build-arg UID=501' | |
| 432 | 442 | ``` |
| 433 | 443 | |
| 434 | 444 | This is particularly useful if you’re putting your repository on a |
| 435 | 445 | Docker volume since the IDs “leak” out into the host environment via |
| 436 | 446 | file permissions. You may therefore wish them to mean something on both |
| 437 | 447 | sides of the container barrier rather than have “499” appear on the host |
| 438 | 448 | in “`ls -l`” output. |
| 449 | + | |
| 450 | + | |
| 451 | +### 5.3 <a id="config"></a>Fossil Configuration Options | |
| 452 | + | |
| 453 | +You can use this same mechanism to enable non-default Fossil | |
| 454 | +configuration options in your build. For instance, to turn on | |
| 455 | +the JSON API and the TH1 docs extension: | |
| 456 | + | |
| 457 | +``` | |
| 458 | + $ make container-image \ | |
| 459 | + DBFLAGS='--build-arg FSLCFG="--json --with-th1-docs"' | |
| 460 | +``` | |
| 461 | + | |
| 439 | 462 | |
| 440 | 463 | |
| 441 | 464 | ## 6. <a id="light"></a>Lightweight Alternatives to Docker |
| 442 | 465 | |
| 443 | 466 | Those afflicted with sticker shock at seeing the size of a [Docker |
| 444 | 467 |
| --- www/containers.md | |
| +++ www/containers.md | |
| @@ -392,24 +392,33 @@ | |
| 392 | don’t blindly update the BusyBox version merely because a new release |
| 393 | came out. Someone needs to get around to vetting it against our stock |
| 394 | configuration first. |
| 395 | |
| 396 | As for Fossil, it defaults to fetching the same version as the checkout |
| 397 | you’re running the build command from, based on checkin ID. The most |
| 398 | common reason to override this is to get a release version: |
| 399 | |
| 400 | ``` |
| 401 | $ docker build -t fossil \ |
| 402 | --build-arg FSLVER=version-2.19 . |
| 403 | ``` |
| 404 | |
| 405 | It’s best to use a specific version number rather than the generic |
| 406 | “`release`” tag because Docker caches downloaded files and tries to |
| 407 | reuse them across builds. If you ask for “`release`” before a new |
| 408 | version is tagged and then immediately after, you might expect to get |
| 409 | two different tarballs, but because the URL hasn’t changed, if you have |
| 410 | an old release tarball in your Docker cache, you’ll get the old version |
| 411 | even if you pass the “`docker build --no-cache`” option. |
| 412 | |
| 413 | This is why we default to pulling the Fossil tarball by checkin ID |
| 414 | rather than let it default to the generic “`trunk`” tag: so the URL will |
| 415 | change each time you update your Fossil source tree, forcing Docker to |
| @@ -426,18 +435,32 @@ | |
| 426 | close to zero as we can manage. |
| 427 | |
| 428 | To change it to something else, say: |
| 429 | |
| 430 | ``` |
| 431 | $ docker build -t fossil --build-arg UID=501 . |
| 432 | ``` |
| 433 | |
| 434 | This is particularly useful if you’re putting your repository on a |
| 435 | Docker volume since the IDs “leak” out into the host environment via |
| 436 | file permissions. You may therefore wish them to mean something on both |
| 437 | sides of the container barrier rather than have “499” appear on the host |
| 438 | in “`ls -l`” output. |
| 439 | |
| 440 | |
| 441 | ## 6. <a id="light"></a>Lightweight Alternatives to Docker |
| 442 | |
| 443 | Those afflicted with sticker shock at seeing the size of a [Docker |
| 444 |
| --- www/containers.md | |
| +++ www/containers.md | |
| @@ -392,24 +392,33 @@ | |
| 392 | don’t blindly update the BusyBox version merely because a new release |
| 393 | came out. Someone needs to get around to vetting it against our stock |
| 394 | configuration first. |
| 395 | |
| 396 | As for Fossil, it defaults to fetching the same version as the checkout |
| 397 | you’re running the build command from, based on checkin ID. You could |
| 398 | use this to get a release build, for instance: |
| 399 | |
| 400 | ``` |
| 401 | $ docker build -t fossil \ |
| 402 | --build-arg FSLVER=version-2.20 . |
| 403 | ``` |
| 404 | |
| 405 | Or equivalently, using Fossil’s `Makefile` convenience target: |
| 406 | |
| 407 | ``` |
| 408 | $ make container-image \ |
| 409 | DBFLAGS='--build-arg FSLVER=version-2.20' |
| 410 | ``` |
| 411 | |
| 412 | While you could instead use the generic |
| 413 | “`release`” tag here, it’s better to use a specific version number |
| 414 | since Docker caches downloaded files and tries to |
| 415 | reuse them across builds. If you ask for “`release`” before a new |
| 416 | version is tagged and then immediately after, you might expect to get |
| 417 | two different tarballs, but because the underlying source tarball URL |
| 418 | remains the same when you do that, you’ll end up reusing the |
| 419 | old tarball from your Docker cache. This will occur |
| 420 | even if you pass the “`docker build --no-cache`” option. |
| 421 | |
| 422 | This is why we default to pulling the Fossil tarball by checkin ID |
| 423 | rather than let it default to the generic “`trunk`” tag: so the URL will |
| 424 | change each time you update your Fossil source tree, forcing Docker to |
| @@ -426,18 +435,32 @@ | |
| 435 | close to zero as we can manage. |
| 436 | |
| 437 | To change it to something else, say: |
| 438 | |
| 439 | ``` |
| 440 | $ make container-image \ |
| 441 | DBFLAGS='--build-arg UID=501' |
| 442 | ``` |
| 443 | |
| 444 | This is particularly useful if you’re putting your repository on a |
| 445 | Docker volume since the IDs “leak” out into the host environment via |
| 446 | file permissions. You may therefore wish them to mean something on both |
| 447 | sides of the container barrier rather than have “499” appear on the host |
| 448 | in “`ls -l`” output. |
| 449 | |
| 450 | |
| 451 | ### 5.3 <a id="config"></a>Fossil Configuration Options |
| 452 | |
| 453 | You can use this same mechanism to enable non-default Fossil |
| 454 | configuration options in your build. For instance, to turn on |
| 455 | the JSON API and the TH1 docs extension: |
| 456 | |
| 457 | ``` |
| 458 | $ make container-image \ |
| 459 | DBFLAGS='--build-arg FSLCFG="--json --with-th1-docs"' |
| 460 | ``` |
| 461 | |
| 462 | |
| 463 | |
| 464 | ## 6. <a id="light"></a>Lightweight Alternatives to Docker |
| 465 | |
| 466 | Those afflicted with sticker shock at seeing the size of a [Docker |
| 467 |