Skip to content

Commit a9fc408

Browse files
committed
Cache the chroot in the GitLab CI image
This makes the integration test a bit faster: - Expected to be slower in downloading the CI docker image - Faster in not having to build the chroot Building within the Dockerfile is difficult as we need privileged to chroot, this is non easy so we build outside and copy the result in, this also saves us in the cache of the apt packages.
1 parent 6d98ef2 commit a9fc408

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

.github/workflows/build-gitlab-container-PR.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ jobs:
4848
with:
4949
images: ghcr.io/${{ github.repository }}
5050

51+
- name: Building an example chroot
52+
run: docker-gitlabci/build_ci_chroot.sh
53+
5154
- name: Build and push Docker images
5255
uses: docker/build-push-action@v5
5356
with:

.github/workflows/build-gitlab-container-release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ jobs:
3535
with:
3636
images: domjudge/gitlabci
3737

38+
- name: Building an example chroot
39+
run: docker-gitlabci/build_ci_chroot.sh
40+
3841
- name: Build and push Docker images
3942
uses: docker/build-push-action@v5
4043
with:

docker-gitlabci/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,5 @@ RUN wget $GITHUBDICTIONARY -O $CODESPELLDICTLOCATION
6363
# Do some extra setup
6464
RUN mkdir -p /run/php \
6565
&& rm /etc/php/*/fpm/pool.d/www.conf
66+
67+
ADD ["domjudge-main/chroot.tar", "/"]

docker-gitlabci/build_ci_chroot.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
3+
sudo apt install acl composer debootstrap g++ gcc libcgroup-dev lsof make \
4+
mariadb-server nginx ntp php php-bcmath php-cli php-curl \
5+
php-fpm php-gd php-intl php-json php-mbstring php-mysql \
6+
php-xml php-zip pkg-config procps pv python3-yaml sudo unzip zip
7+
8+
cd docker-gitlabci || exit 1
9+
wget https://github.com/DOMjudge/domjudge/archive/refs/heads/main.zip
10+
unzip main.zip
11+
cd domjudge-main || exit 1
12+
chroot_path="$(pwd)/chroot"
13+
make configure
14+
./configure --with-domjudge-user=domjudge --with-judgehost_chrootdir="${chroot_path}"
15+
cd misc-tools || exit 1
16+
make dj_make_chroot
17+
sudo ./dj_make_chroot
18+
sudo tar -cvf "${chroot_path}.tar" "${chroot_path}"

0 commit comments

Comments
 (0)