dishplanner/docker/build/Dockerfile.ci
myrmidex 7954d9499d
All checks were successful
CI / ci (push) Successful in 2m7s
CI / ci (pull_request) Successful in 33s
46 - Pre-load PHP dependencies into the CI image
2026-08-17 21:18:01 +02:00

44 lines
1.8 KiB
Text

# CI image: PHP + Composer only, no runtime server or frontend toolchain.
# Tests run against SQLite in memory (see .env.testing), so no database client
# or cache extension is needed.
#
# Published as dishplanner-ci:php8.3-<revision>. Bump the revision in the tag
# (.forgejo/workflows/images.yml) and in .forgejo/workflows/ci.yml whenever
# this file changes (runners cache mutable tags and will not re-pull them).
#
# Debian-based rather than Alpine to avoid the DNS resolution timeouts against
# codeload.github.com that the Alpine base hit during composer install.
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_sqlite \
mbstring \
dom \
xml \
fileinfo \
pcntl \
zip
# git is needed by the checkout action; nodejs runs the Forgejo JavaScript
# actions (checkout, cache); unzip lets Composer extract dist archives.
RUN apt-get update \
&& apt-get install -y --no-install-recommends git unzip nodejs \
&& rm -rf /var/lib/apt/lists/*
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
# Bake the project's PHP dependencies (dev included) into the image so CI
# restores them with a local copy instead of paying a per-run composer install
# over the network. Build this image on a network that isn't
# codeload-rate-limited (e.g. locally) — the Forgejo runner hits codeload 429
# under --prefer-dist.
#
# --no-scripts skips `php artisan package:discover` (the app isn't present
# here). CI runs `composer install` after restoring vendor, which regenerates
# bootstrap/cache and tops up any lockfile drift between main and release/*.
WORKDIR /opt/deps
COPY composer.json composer.lock ./
RUN composer install --no-interaction --no-progress --prefer-dist --no-scripts