From 1fecc2b47fd0c406a51401f4c961b4b5e2d51c06 Mon Sep 17 00:00:00 2001 From: myrmidex Date: Sun, 16 Aug 2026 01:12:25 +0200 Subject: [PATCH] 57 - Add prebuilt CI image and images.yml workflow --- .forgejo/workflows/ci.yml | 13 +++-------- .forgejo/workflows/images.yml | 44 +++++++++++++++++++++++++++++++++++ docker/build/Dockerfile.ci | 35 ++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 10 deletions(-) create mode 100644 .forgejo/workflows/images.yml create mode 100644 docker/build/Dockerfile.ci diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index a4127b0..ad9db61 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: ci: runs-on: docker container: - image: catthehacker/ubuntu:act-latest + image: forge.lvl0.xyz/lvl0/incr-ci:php8.3-1 services: db: @@ -24,17 +24,10 @@ jobs: steps: - uses: https://data.forgejo.org/actions/checkout@v4 - - name: Set up PHP - uses: https://github.com/shivammathur/setup-php@v2 - with: - php-version: '8.3' - extensions: pdo_mysql, mbstring, xml, dom, bcmath, gd, exif, pcntl - coverage: pcov - - name: Cache Composer dependencies uses: https://data.forgejo.org/actions/cache@v4 with: - path: ~/.composer/cache + path: ~/.cache/composer key: composer-${{ hashFiles('composer.lock') }} restore-keys: composer- @@ -134,7 +127,7 @@ jobs: build: runs-on: docker container: - image: catthehacker/ubuntu:act-latest + image: node:22-bookworm-slim steps: - uses: https://data.forgejo.org/actions/checkout@v4 diff --git a/.forgejo/workflows/images.yml b/.forgejo/workflows/images.yml new file mode 100644 index 0000000..5e165c9 --- /dev/null +++ b/.forgejo/workflows/images.yml @@ -0,0 +1,44 @@ +name: Build and Push CI Image + +on: + push: + branches: [main] + paths: + - 'docker/build/**' + - '.forgejo/workflows/images.yml' + workflow_dispatch: + +jobs: + images: + runs-on: docker + container: + image: catthehacker/ubuntu:act-latest + strategy: + matrix: + include: + - name: incr-ci + file: docker/build/Dockerfile.ci + version: php8.3-1 + steps: + - uses: https://data.forgejo.org/actions/checkout@v4 + + - name: Set up Docker Buildx + uses: https://data.forgejo.org/docker/setup-buildx-action@v3 + + - name: Login to Forgejo Registry + uses: https://data.forgejo.org/docker/login-action@v3 + with: + registry: forge.lvl0.xyz + username: ${{ github.actor }} + password: ${{ secrets.REGISTRY_TOKEN }} + + - name: Build and push + uses: https://data.forgejo.org/docker/build-push-action@v5 + with: + context: . + file: ${{ matrix.file }} + push: true + tags: | + forge.lvl0.xyz/lvl0/${{ matrix.name }}:${{ matrix.version }} + forge.lvl0.xyz/lvl0/${{ matrix.name }}:latest + forge.lvl0.xyz/lvl0/${{ matrix.name }}:${{ github.sha }} diff --git a/docker/build/Dockerfile.ci b/docker/build/Dockerfile.ci new file mode 100644 index 0000000..512019c --- /dev/null +++ b/docker/build/Dockerfile.ci @@ -0,0 +1,35 @@ +# Image for CI: PHP, Composer and the extensions the suite needs. No runtime +# server; the frontend build runs in its own job on a node image. +# +# Published as incr-ci:php-, not :latest. Runners cache +# mutable tags and will not re-pull them, so bump the revision in the tag and +# in ci.yml whenever this file changes. +# +# Debian-based rather than alpine: ffr hit repeated DNS resolution timeouts +# against codeload.github.com on the alpine build. +# +# pdo_mysql, not sqlite: the migration tests query information_schema and +# exercise MySQL-specific DDL, so CI runs against a real mysql:8.0 service. +FROM php:8.3-cli + +COPY --from=mlocati/php-extension-installer:2 /usr/bin/install-php-extensions /usr/local/bin/ + +RUN install-php-extensions \ + pdo_mysql \ + mbstring \ + dom \ + xml \ + bcmath \ + fileinfo \ + pcntl \ + gd \ + pcov + +# netcat-openbsd backs the MySQL readiness check in ci.yml. +# nodejs is not used by the app's tests; the Forgejo JavaScript actions +# (checkout, cache) are executed with it inside this container. +RUN apt-get update \ + && apt-get install -y --no-install-recommends git unzip nodejs netcat-openbsd \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=composer:2 /usr/bin/composer /usr/bin/composer