add weekly build, change to trixie and clean up

This commit is contained in:
Pau Capó 2025-08-10 11:07:45 +02:00
parent 15adccd03c
commit 76b56114b5
3 changed files with 52 additions and 15 deletions

View file

@ -0,0 +1,50 @@
name: Weekly Docker Image Rebuild
on:
schedule:
- cron: '0 2 * * 0'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: git.paucapo.com
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Build and push PHP images
run: |
PHP_VERSIONS="7.4 8.0 8.1 8.2"
PLATFORMS="linux/arm64/v8,linux/amd64"
docker buildx create --use --platform=linux/arm64/v8,linux/amd64 --name multi-platform-builder
docker buildx inspect --bootstrap
for PHP_VERSION in ${PHP_VERSIONS}; do
echo "Building php:${PHP_VERSION}"
docker buildx build \
--no-cache \
--platform=${PLATFORMS} \
--push \
-f "./Dockerfile-php" \
-t "git.paucapo.com/server/php:${PHP_VERSION}" \
--build-arg PHP_VERSION=${PHP_VERSION} \
.
done
docker buildx rm multi-platform-builder --force
- name: Cleanup
if: always()
run: |
docker image prune -a --force

View file

@ -1,7 +1,6 @@
FROM debian:bookworm-slim
FROM debian:trixie-slim
ARG PHP_VERSION=7.4
ARG WKHTML=""
RUN apt-get update -y
RUN apt-get upgrade -y
@ -19,19 +18,12 @@ RUN apt-get install -y --no-install-recommends imagemagick apache2 msmtp msmtp-m
php${PHP_VERSION}-imagick php${PHP_VERSION}-intl php${PHP_VERSION}-mbstring \
php${PHP_VERSION}-mysql php${PHP_VERSION}-opcache php${PHP_VERSION}-readline php${PHP_VERSION}-sqlite3 \
php${PHP_VERSION}-xml php${PHP_VERSION}-yaml php${PHP_VERSION}-zip php${PHP_VERSION}-apcu \
php${PHP_VERSION}-redis \
libapache2-mod-php${PHP_VERSION}
# specific PHP modules for some versions
RUN if [[ "${PHP_VERSION}" == "7.4" ]] ; then apt-get -y install php${PHP_VERSION}-json; fi
# install wkhtml if needed
RUN if [[ "${WKHTML}" != "" ]] ; then \
apt-get install -y --no-install-recommends libfreetype6-dev libjpeg62-turbo-dev libpng-dev fontconfig libfreetype6 libjpeg62-turbo \
libpng16-16 libx11-6 libxcb1 libxext6 libxrender1 xfonts-75dpi xfonts-base; \
curl -L https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_arm64.deb -o /tmp/wkhtmltox.deb; \
dpkg -i /tmp/wkhtmltox.deb; \
fi
# upgrade system a second time
RUN apt-get upgrade -y

View file

@ -1,7 +1,6 @@
#!/bin/bash
PHP_VERSIONS="7.4 8.0 8.1 8.2"
WKHTML=""
PLATFORMS="linux/arm64/v8,linux/amd64"
# testing
@ -36,10 +35,6 @@ for PHP_VERSION in ${PHP_VERSIONS}; do
build ${PHP_VERSION} ${PHP_VERSION}
done
for PHP_VERSION in ${WKHTML}; do
build "${PHP_VERSION}-wkhtml" "${PHP_VERSION}" "--build-arg WKHTML=1"
done
docker buildx rm multi-platform-builder --force
docker image prune -a --force