From 6aedab4f1bbb327e9920376ba84fc0e196ff36e9 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Sun, 30 Nov 2025 12:58:43 +0100 Subject: [PATCH 01/14] First pass to cache the chroot --- docker-gitlabci/Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docker-gitlabci/Dockerfile b/docker-gitlabci/Dockerfile index 8472933f..e8ba15da 100644 --- a/docker-gitlabci/Dockerfile +++ b/docker-gitlabci/Dockerfile @@ -63,3 +63,8 @@ RUN wget $GITHUBDICTIONARY -O $CODESPELLDICTLOCATION # Do some extra setup RUN mkdir -p /run/php \ && rm /etc/php/*/fpm/pool.d/www.conf + +# Cache the chroot +RUN wget https://github.com/DOMjudge/domjudge/archive/refs/heads/main.zip \ + && unzip domjudge-main.zip && cd domjudge-main/misc-tools && make dj_make_chroot \ + && ./dj_make_chroot From 7fe311075a44b08608870e666e465c58d7e38a6e Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Sun, 30 Nov 2025 13:44:33 +0100 Subject: [PATCH 02/14] And show where the space gets lost --- docker-gitlabci/Dockerfile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docker-gitlabci/Dockerfile b/docker-gitlabci/Dockerfile index e8ba15da..6e379d32 100644 --- a/docker-gitlabci/Dockerfile +++ b/docker-gitlabci/Dockerfile @@ -64,7 +64,13 @@ RUN wget $GITHUBDICTIONARY -O $CODESPELLDICTLOCATION RUN mkdir -p /run/php \ && rm /etc/php/*/fpm/pool.d/www.conf +RUN du -sh /* + # Cache the chroot RUN wget https://github.com/DOMjudge/domjudge/archive/refs/heads/main.zip \ - && unzip domjudge-main.zip && cd domjudge-main/misc-tools && make dj_make_chroot \ - && ./dj_make_chroot + && unzip main.zip && cd domjudge-main/misc-tools && make configure \ + && cd misc-tools && make dj_make_chroot \ + && ./dj_make_chroot \ + && cd ../.. && rm -rf domjudge-main + +RUN du -sh /* From 36fb505863ffe0afb660c96c4c15f62fc9af78b8 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Tue, 9 Dec 2025 10:59:06 +0100 Subject: [PATCH 03/14] Allow explicit failure --- docker-gitlabci/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-gitlabci/Dockerfile b/docker-gitlabci/Dockerfile index 6e379d32..85a6e966 100644 --- a/docker-gitlabci/Dockerfile +++ b/docker-gitlabci/Dockerfile @@ -64,7 +64,7 @@ RUN wget $GITHUBDICTIONARY -O $CODESPELLDICTLOCATION RUN mkdir -p /run/php \ && rm /etc/php/*/fpm/pool.d/www.conf -RUN du -sh /* +RUN du -sh /* || true # Cache the chroot RUN wget https://github.com/DOMjudge/domjudge/archive/refs/heads/main.zip \ @@ -73,4 +73,4 @@ RUN wget https://github.com/DOMjudge/domjudge/archive/refs/heads/main.zip \ && ./dj_make_chroot \ && cd ../.. && rm -rf domjudge-main -RUN du -sh /* +RUN du -sh /* || true From c5b945790994634a629936b4a2bc439417b7ec6f Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Tue, 9 Dec 2025 11:27:47 +0100 Subject: [PATCH 04/14] Simplify debugging --- docker-gitlabci/Dockerfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docker-gitlabci/Dockerfile b/docker-gitlabci/Dockerfile index 85a6e966..1c30cecc 100644 --- a/docker-gitlabci/Dockerfile +++ b/docker-gitlabci/Dockerfile @@ -67,10 +67,11 @@ RUN mkdir -p /run/php \ RUN du -sh /* || true # Cache the chroot -RUN wget https://github.com/DOMjudge/domjudge/archive/refs/heads/main.zip \ - && unzip main.zip && cd domjudge-main/misc-tools && make configure \ - && cd misc-tools && make dj_make_chroot \ - && ./dj_make_chroot \ - && cd ../.. && rm -rf domjudge-main +RUN pwd && wget https://github.com/DOMjudge/domjudge/archive/refs/heads/main.zip +RUN pwd && unzip main.zip +RUN pwd && cd domjudge-main/misc-tools && make configure +RUN pwd && make dj_make_chroot +RUN pwd && ./dj_make_chroot +RUN pwd && cd ../.. && rm -rf domjudge-main RUN du -sh /* || true From 6585b46bb4dff2a2a1f79b0c95fc2d4d1884750c Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Tue, 9 Dec 2025 14:19:49 +0100 Subject: [PATCH 05/14] fixup --- docker-gitlabci/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-gitlabci/Dockerfile b/docker-gitlabci/Dockerfile index 1c30cecc..a26127f8 100644 --- a/docker-gitlabci/Dockerfile +++ b/docker-gitlabci/Dockerfile @@ -69,8 +69,8 @@ RUN du -sh /* || true # Cache the chroot RUN pwd && wget https://github.com/DOMjudge/domjudge/archive/refs/heads/main.zip RUN pwd && unzip main.zip -RUN pwd && cd domjudge-main/misc-tools && make configure -RUN pwd && make dj_make_chroot +RUN pwd && cd domjudge-main && make configure +RUN pwd && cd misc-tools && make dj_make_chroot RUN pwd && ./dj_make_chroot RUN pwd && cd ../.. && rm -rf domjudge-main From ff6c62c8bb036087e672eeae9e2b57164939a0f8 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Tue, 9 Dec 2025 14:44:50 +0100 Subject: [PATCH 06/14] Make steps explicit --- docker-gitlabci/Dockerfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docker-gitlabci/Dockerfile b/docker-gitlabci/Dockerfile index a26127f8..21b0b88a 100644 --- a/docker-gitlabci/Dockerfile +++ b/docker-gitlabci/Dockerfile @@ -67,11 +67,11 @@ RUN mkdir -p /run/php \ RUN du -sh /* || true # Cache the chroot -RUN pwd && wget https://github.com/DOMjudge/domjudge/archive/refs/heads/main.zip -RUN pwd && unzip main.zip -RUN pwd && cd domjudge-main && make configure -RUN pwd && cd misc-tools && make dj_make_chroot -RUN pwd && ./dj_make_chroot -RUN pwd && cd ../.. && rm -rf domjudge-main +RUN cd / && wget https://github.com/DOMjudge/domjudge/archive/refs/heads/main.zip +RUN cd / && unzip main.zip +RUN cd /domjudge-main && make configure +RUN cd /domjudge-main/misc-tools && make dj_make_chroot +RUN cd /domjudge-main/misc-tools && ./dj_make_chroot +RUN rm -rf /domjudge-main RUN du -sh /* || true From 86a14ae66e5328f867c1d667af19f525c48f6642 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Tue, 9 Dec 2025 16:43:44 +0100 Subject: [PATCH 07/14] Fix the build (?) --- docker-gitlabci/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-gitlabci/Dockerfile b/docker-gitlabci/Dockerfile index 21b0b88a..82e98377 100644 --- a/docker-gitlabci/Dockerfile +++ b/docker-gitlabci/Dockerfile @@ -70,6 +70,7 @@ RUN du -sh /* || true RUN cd / && wget https://github.com/DOMjudge/domjudge/archive/refs/heads/main.zip RUN cd / && unzip main.zip RUN cd /domjudge-main && make configure +RUN cd /domjudge-main && ./configure --with-domjudge-user=domjudge RUN cd /domjudge-main/misc-tools && make dj_make_chroot RUN cd /domjudge-main/misc-tools && ./dj_make_chroot RUN rm -rf /domjudge-main From 2ea6113623c59067c05188d6a24b94d75f839954 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Wed, 10 Dec 2025 11:50:25 +0100 Subject: [PATCH 08/14] Try to build the chroot outside first We need priviliges for the debootstrap, passing this to buildx is far from easy and we only need a simple setup --- docker-gitlabci/Dockerfile | 13 +------------ docker-gitlabci/build.sh | 10 ++++++++++ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/docker-gitlabci/Dockerfile b/docker-gitlabci/Dockerfile index 82e98377..8df5908b 100644 --- a/docker-gitlabci/Dockerfile +++ b/docker-gitlabci/Dockerfile @@ -64,15 +64,4 @@ RUN wget $GITHUBDICTIONARY -O $CODESPELLDICTLOCATION RUN mkdir -p /run/php \ && rm /etc/php/*/fpm/pool.d/www.conf -RUN du -sh /* || true - -# Cache the chroot -RUN cd / && wget https://github.com/DOMjudge/domjudge/archive/refs/heads/main.zip -RUN cd / && unzip main.zip -RUN cd /domjudge-main && make configure -RUN cd /domjudge-main && ./configure --with-domjudge-user=domjudge -RUN cd /domjudge-main/misc-tools && make dj_make_chroot -RUN cd /domjudge-main/misc-tools && ./dj_make_chroot -RUN rm -rf /domjudge-main - -RUN du -sh /* || true +COPY ["chroot", "/chroot"] diff --git a/docker-gitlabci/build.sh b/docker-gitlabci/build.sh index 74f21a5e..b081cfdd 100755 --- a/docker-gitlabci/build.sh +++ b/docker-gitlabci/build.sh @@ -20,6 +20,16 @@ else REGISTRY=$2 fi +echo "[..] Building an example chroot..." +wget https://github.com/DOMjudge/domjudge/archive/refs/heads/main.zip +unzip main.zip +cd domjudge-main + make configure + ./configure --with-domjudge-user=domjudge --with-judgehost_chrootdir=`pwd`/chroot +cd misc-tools + make dj_make_chroot + sudo ./dj_make_chroot + echo "[..] Building Docker image for Gitlab CI..." cp -r ../docker-contributor/php-config ./ docker build -t "${REGISTRY}:${VERSION}" . From 2e649d5725b7b43f24295bcd353921ff91ddf47e Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Wed, 10 Dec 2025 23:54:10 +0100 Subject: [PATCH 09/14] Fix shellcheck issues --- docker-gitlabci/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-gitlabci/build.sh b/docker-gitlabci/build.sh index b081cfdd..fb784c7e 100755 --- a/docker-gitlabci/build.sh +++ b/docker-gitlabci/build.sh @@ -25,7 +25,7 @@ wget https://github.com/DOMjudge/domjudge/archive/refs/heads/main.zip unzip main.zip cd domjudge-main make configure - ./configure --with-domjudge-user=domjudge --with-judgehost_chrootdir=`pwd`/chroot + ./configure --with-domjudge-user=domjudge --with-judgehost_chrootdir="$(pwd)/chroot" cd misc-tools make dj_make_chroot sudo ./dj_make_chroot From 580571c13091b1b7da75805c7cda3e1339ecf877 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Wed, 10 Dec 2025 23:58:21 +0100 Subject: [PATCH 10/14] Copy to the right dir (?) --- docker-gitlabci/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-gitlabci/Dockerfile b/docker-gitlabci/Dockerfile index 8df5908b..58efbcd0 100644 --- a/docker-gitlabci/Dockerfile +++ b/docker-gitlabci/Dockerfile @@ -64,4 +64,4 @@ RUN wget $GITHUBDICTIONARY -O $CODESPELLDICTLOCATION RUN mkdir -p /run/php \ && rm /etc/php/*/fpm/pool.d/www.conf -COPY ["chroot", "/chroot"] +COPY ["chroot", "/"] From a89a77dcf8bcec836cd694aee5720610f5cd793c Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Thu, 11 Dec 2025 11:52:55 +0100 Subject: [PATCH 11/14] =?UTF-8?q?We=20don=C2=B4t=20use=20the=20build=20scr?= =?UTF-8?q?ipt=20anymore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-gitlab-container-PR.yml | 11 +++++++++++ docker-gitlabci/build.sh | 11 +---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-gitlab-container-PR.yml b/.github/workflows/build-gitlab-container-PR.yml index 662580e1..8745cc76 100644 --- a/.github/workflows/build-gitlab-container-PR.yml +++ b/.github/workflows/build-gitlab-container-PR.yml @@ -48,6 +48,17 @@ jobs: with: images: ghcr.io/${{ github.repository }} + - name: Building an example chroot... + run: | + wget https://github.com/DOMjudge/domjudge/archive/refs/heads/main.zip + unzip main.zip + cd domjudge-main + make configure + ./configure --with-domjudge-user=domjudge --with-judgehost_chrootdir="$(pwd)/chroot" + cd misc-tools + make dj_make_chroot + sudo ./dj_make_chroot + - name: Build and push Docker images uses: docker/build-push-action@v5 with: diff --git a/docker-gitlabci/build.sh b/docker-gitlabci/build.sh index fb784c7e..0b637933 100755 --- a/docker-gitlabci/build.sh +++ b/docker-gitlabci/build.sh @@ -1,5 +1,6 @@ #!/bin/bash -e +# This script is not used in GHA CI if [[ -n ${CI} ]] then set -euxo pipefail @@ -20,16 +21,6 @@ else REGISTRY=$2 fi -echo "[..] Building an example chroot..." -wget https://github.com/DOMjudge/domjudge/archive/refs/heads/main.zip -unzip main.zip -cd domjudge-main - make configure - ./configure --with-domjudge-user=domjudge --with-judgehost_chrootdir="$(pwd)/chroot" -cd misc-tools - make dj_make_chroot - sudo ./dj_make_chroot - echo "[..] Building Docker image for Gitlab CI..." cp -r ../docker-contributor/php-config ./ docker build -t "${REGISTRY}:${VERSION}" . From 4376b3280c993ed0f9efbde88c4ac745fc684e3c Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Thu, 11 Dec 2025 17:53:54 +0100 Subject: [PATCH 12/14] Install all needed tools --- .github/workflows/build-gitlab-container-PR.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-gitlab-container-PR.yml b/.github/workflows/build-gitlab-container-PR.yml index 8745cc76..5df6565d 100644 --- a/.github/workflows/build-gitlab-container-PR.yml +++ b/.github/workflows/build-gitlab-container-PR.yml @@ -50,6 +50,7 @@ jobs: - name: Building an example chroot... run: | + sudo apt install make pkg-config sudo debootstrap libcgroup-dev php-cli php-curl php-json php-xml php-zip lsof procps gcc g++ libcgroup-dev make acl zip unzip pv mariadb-server nginx php php-fpm php-gd php-cli php-intl php-mbstring php-mysql php-curl php-json php-xml php-zip composer ntp python3-yaml php-bcmath wget https://github.com/DOMjudge/domjudge/archive/refs/heads/main.zip unzip main.zip cd domjudge-main From 0c12f4ffc4ccd9c91bd3ad14b77dd96359599ab1 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Thu, 11 Dec 2025 18:52:22 +0100 Subject: [PATCH 13/14] Check --- docker-gitlabci/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-gitlabci/Dockerfile b/docker-gitlabci/Dockerfile index 58efbcd0..f51eef6c 100644 --- a/docker-gitlabci/Dockerfile +++ b/docker-gitlabci/Dockerfile @@ -64,4 +64,4 @@ RUN wget $GITHUBDICTIONARY -O $CODESPELLDICTLOCATION RUN mkdir -p /run/php \ && rm /etc/php/*/fpm/pool.d/www.conf -COPY ["chroot", "/"] +COPY ["domjudge-main/chroot", "/"] From f7d95831fdb05f67249eb1ea5670dc540a5d0264 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Thu, 11 Dec 2025 19:33:25 +0100 Subject: [PATCH 14/14] Does this work (?) --- .github/workflows/build-gitlab-container-PR.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-gitlab-container-PR.yml b/.github/workflows/build-gitlab-container-PR.yml index 5df6565d..6c18dc52 100644 --- a/.github/workflows/build-gitlab-container-PR.yml +++ b/.github/workflows/build-gitlab-container-PR.yml @@ -60,6 +60,8 @@ jobs: make dj_make_chroot sudo ./dj_make_chroot + - run: | + find . --name chroot - name: Build and push Docker images uses: docker/build-push-action@v5 with: