57 - Add prebuilt CI image and images.yml workflow
This commit is contained in:
parent
18fa9000e5
commit
1fecc2b47f
3 changed files with 82 additions and 10 deletions
|
|
@ -10,7 +10,7 @@ jobs:
|
||||||
ci:
|
ci:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
container:
|
||||||
image: catthehacker/ubuntu:act-latest
|
image: forge.lvl0.xyz/lvl0/incr-ci:php8.3-1
|
||||||
|
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
|
|
@ -24,17 +24,10 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: https://data.forgejo.org/actions/checkout@v4
|
- 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
|
- name: Cache Composer dependencies
|
||||||
uses: https://data.forgejo.org/actions/cache@v4
|
uses: https://data.forgejo.org/actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ~/.composer/cache
|
path: ~/.cache/composer
|
||||||
key: composer-${{ hashFiles('composer.lock') }}
|
key: composer-${{ hashFiles('composer.lock') }}
|
||||||
restore-keys: composer-
|
restore-keys: composer-
|
||||||
|
|
||||||
|
|
@ -134,7 +127,7 @@ jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
container:
|
||||||
image: catthehacker/ubuntu:act-latest
|
image: node:22-bookworm-slim
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: https://data.forgejo.org/actions/checkout@v4
|
- uses: https://data.forgejo.org/actions/checkout@v4
|
||||||
|
|
|
||||||
44
.forgejo/workflows/images.yml
Normal file
44
.forgejo/workflows/images.yml
Normal file
|
|
@ -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 }}
|
||||||
35
docker/build/Dockerfile.ci
Normal file
35
docker/build/Dockerfile.ci
Normal file
|
|
@ -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<version>-<revision>, 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
|
||||||
Loading…
Reference in a new issue