File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,12 +54,12 @@ jobs:
5454 - name : Build base image
5555 if : ${{ matrix.has_base }}
5656 run : |
57- cd ${{ matrix.image }} && . /build.sh
57+ LAYERS_DIR="${{ runner.temp }}/layers/ ${{ matrix.image }}" ${{ matrix.image }} /build.sh
5858 - name : Build and push
5959 uses : docker/build-push-action@v7
6060 with :
6161 context : " ${{ matrix.image }}"
62- build-contexts : ${{ matrix.has_base && format('base=oci-layout://{0}/layers:base', matrix.image) || '' }}
62+ build-contexts : ${{ matrix.has_base && format('base=oci-layout://{0}/layers/{1} :base', runner.temp , matrix.image) || '' }}
6363 tags : ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ matrix.image }}:latest
6464 cache-from : type=registry,ref=${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ matrix.image }}:latest
6565 cache-to : type=inline
Load diff This file was deleted.
Original file line number Diff line number Diff line change 11/* .tar
2- /layers
Original file line number Diff line number Diff line change @@ -3,8 +3,10 @@ FROM ghcr.io/toktok/bazel:base AS base
33FROM scratch
44# hadolint ignore=DL3022,DL3067
55COPY --from=base / /
6- # Reinstate the CMD directive from the squashed image.
6+ # Reinstate the CMD and STOPSIGNAL directives from the squashed image so
7+ # `docker stop` shuts systemd down cleanly instead of waiting for SIGKILL.
78CMD ["/usr/sbin/init" ]
9+ STOPSIGNAL SIGRTMIN+3
810
911# We need to know where our bash is, because we haven't set up /bin/sh yet.
1012ENV NIXOS_VERSION="2786a2a72088ecf32aea5b3ec52099e6a7cff78f"
Original file line number Diff line number Diff line change 4343 boot. specialFileSystems = lib . mkForce { } ;
4444 boot. tmp. useTmpfs = true ;
4545 nix. settings. sandbox = false ;
46- nix. settings. auto-optimise-store = true ;
46+
47+ # Avoid /nix/store/.links: in Docker overlay2 it saves 1%.
48+ nix. settings. auto-optimise-store = false ;
49+
50+ # TokTok's binary cache, so builds whose results aren't on
51+ # cache.nixos.org (Android cross GHCs and NDKs above all) don't have
52+ # to start again after every container restart.
53+ nix. settings. extra-substituters = [ "https://toktok.cachix.org" ] ;
54+ nix. settings. extra-trusted-public-keys = [
55+ "toktok.cachix.org-1:ZijcpD+vG99+1uX65TlXaROvLqP//CGCiFlB5OrIGXY="
56+ ] ;
4757
4858 services. journald. settings. Journal = {
4959 ForwardToConsole = true ;
5262 services. openssh. enable = true ;
5363 services. nscd. enable = false ;
5464
55- system. stateVersion = "25 .11" ;
65+ system. stateVersion = "26 .11" ;
5666 system. nssModules = lib . mkForce [ ] ;
5767
5868 systemd. services. systemd-logind. enable = false ;
7383 pkgs . git
7484 # Needed because coursier (for Kotlin) requires that java is in $PATH.
7585 pkgs . jdk21_headless
76- pkgs . python311
86+ pkgs . python3
7787 ] ;
7888
7989 security. sudo. wheelNeedsPassword = false ;
Original file line number Diff line number Diff line change 22
33set -eux
44
5+ # Everything goes in a temporary directory, not the checkout, which may be on a
6+ # slow network file system. LAYERS_DIR, if set, is where the base image goes as
7+ # an OCI layout, for builds that can't read the local docker images (buildx).
8+ SRC=" $( cd " $( dirname " $0 " ) " && pwd) "
9+ WORK=" $( mktemp -d) "
10+ trap ' rm -rf "$WORK"' EXIT
11+ cd " $WORK "
12+
513# Install nix if it's not there yet (e.g. on Github Actions).
614if ! which nix-shell; then
715 curl -L https://nixos.org/nix/install -o install.sh
816 sh install.sh --no-daemon --no-channel-add --yes
9- rm install.sh
1017 . " $HOME /.nix-profile/etc/profile.d/nix.sh"
1118 nix-channel --add https://github.com/NixOS/nixpkgs/archive/2786a2a72088ecf32aea5b3ec52099e6a7cff78f.tar.gz nixpkgs
1219 nix-channel --update
1320fi
1421
1522# Build a docker image.
16- nix-shell -p arion --run ' arion build'
17- IMAGE=" $( nix-shell -p arion --run ' arion config' | grep -o ' ghcr.io/toktok/bazel:.*' ) "
23+ ARION=" arion --file $SRC /arion-compose.nix --pkgs $SRC /arion-pkgs.nix"
24+ nix-shell -p arion --run " $ARION build"
25+ IMAGE=" $( nix-shell -p arion --run " $ARION config" | grep -o ' ghcr.io/toktok/bazel:.*' ) "
1826
1927docker tag " $IMAGE " " ghcr.io/toktok/bazel:base"
2028
21- mkdir layers
22- docker save " ghcr.io/toktok/bazel:base" | tar -x -C layers
29+ if [ -n " ${LAYERS_DIR:- } " ]; then
30+ mkdir -p " $LAYERS_DIR "
31+ docker save " ghcr.io/toktok/bazel:base" | tar -x -C " $LAYERS_DIR "
32+ fi
You can’t perform that action at this time.
0 commit comments