From a24199fb9f00495a50a4a1afb39e82b71dac61c6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 15:22:38 +0000 Subject: [PATCH 01/16] Initial plan From 6876fd9b43753b63bfe5a83c7b8e2f978cb5cb58 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 15:25:03 +0000 Subject: [PATCH 02/16] Refactor Dockerfiles to use Node.js multistage builds Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com> --- Dockerfile | 55 ++++++++++++++++++++++++++++-------- Dockerfile-frankenphp | 66 ++++++++++++++++++++++++++++--------------- 2 files changed, 88 insertions(+), 33 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8ebd320c1..91dc86984 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,47 @@ ARG BASE_IMAGE=debian:bookworm-slim ARG PHP_VERSION=8.4 +ARG NODE_VERSION=22 +# Node.js build stage for building frontend assets +FROM node:${NODE_VERSION}-bookworm-slim AS node-builder + +WORKDIR /app + +# Install composer - needed for symfony UX packages +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + +# Install minimal PHP for composer (only for installing dependencies) +RUN apt-get update && apt-get install -y --no-install-recommends \ + php-cli \ + php-xml \ + php-mbstring \ + unzip \ + git \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Copy composer files and install PHP dependencies (needed for Symfony UX assets) +COPY composer.json composer.lock symfony.lock ./ +RUN composer install --no-scripts --no-autoloader --no-dev --prefer-dist + +# Copy package files for better layer caching +COPY package.json yarn.lock ./ + +# Install node dependencies +RUN yarn install --network-timeout 600000 + +# Copy necessary files for the build +COPY webpack.config.js ./ +COPY assets ./assets +COPY public ./public +COPY translations ./translations + +# Build the assets +RUN yarn build + +# Clean up +RUN yarn cache clean && rm -rf node_modules/ + +# Base stage for PHP FROM ${BASE_IMAGE} AS base ARG PHP_VERSION @@ -45,13 +86,6 @@ RUN apt-get update && apt-get -y install \ # delete the "index.html" that installing Apache drops in here && rm -rvf /var/www/html/* -# Install node and yarn -RUN curl -sL https://deb.nodesource.com/setup_22.x | bash - && \ - apt-get update && apt-get install -y \ - nodejs \ - && apt-get -y autoremove && apt-get clean autoclean && rm -rf /var/lib/apt/lists/* && \ - npm install -g yarn - # Install composer COPY --from=composer:latest /usr/bin/composer /usr/bin/composer @@ -151,10 +185,9 @@ RUN a2dissite 000-default.conf && \ USER www-data RUN composer install -a --no-dev && \ composer clear-cache -RUN yarn install --network-timeout 600000 && \ - yarn build && \ - yarn cache clean && \ - rm -rf node_modules/ + +# Copy built frontend assets from node-builder stage +COPY --from=node-builder --chown=www-data:www-data /app/public/build ./public/build # Use docker env to output logs to stdout ENV APP_ENV=docker diff --git a/Dockerfile-frankenphp b/Dockerfile-frankenphp index 69b9bacd8..c3fccf40c 100644 --- a/Dockerfile-frankenphp +++ b/Dockerfile-frankenphp @@ -1,3 +1,45 @@ +ARG NODE_VERSION=22 + +# Node.js build stage for building frontend assets +FROM node:${NODE_VERSION}-bookworm-slim AS node-builder + +WORKDIR /app + +# Install composer - needed for symfony UX packages +COPY --from=composer:latest /usr/bin/composer /usr/bin/composer + +# Install minimal PHP for composer (only for installing dependencies) +RUN apt-get update && apt-get install -y --no-install-recommends \ + php-cli \ + php-xml \ + php-mbstring \ + unzip \ + git \ + && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Copy composer files and install PHP dependencies (needed for Symfony UX assets) +COPY composer.json composer.lock symfony.lock ./ +RUN composer install --no-scripts --no-autoloader --no-dev --prefer-dist + +# Copy package files for better layer caching +COPY package.json yarn.lock ./ + +# Install node dependencies +RUN yarn install --network-timeout 600000 + +# Copy necessary files for the build +COPY webpack.config.js ./ +COPY assets ./assets +COPY public ./public +COPY translations ./translations + +# Build the assets +RUN yarn build + +# Clean up +RUN yarn cache clean && rm -rf node_modules/ + +# FrankenPHP base stage FROM dunglas/frankenphp:1-php8.4 AS frankenphp_upstream RUN apt-get update && apt-get -y install \ @@ -13,24 +55,6 @@ RUN apt-get update && apt-get -y install \ zip \ && apt-get -y autoremove && apt-get clean autoclean && rm -rf /var/lib/apt/lists/*; -RUN set -eux; \ - # Run NodeSource setup script - curl -sL https://deb.nodesource.com/setup_22.x | bash -; \ - \ - # Install Node.js - apt-get update; \ - apt-get install -y --no-install-recommends \ - nodejs; \ - \ - # Cleanup - apt-get -y autoremove; \ - apt-get clean autoclean; \ - rm -rf /var/lib/apt/lists/*; \ - \ - # Install Yarn via npm - npm install -g yarn - - # Install PHP RUN set -eux; \ install-php-extensions \ @@ -80,10 +104,8 @@ RUN set -eux; \ composer run-script --no-dev post-install-cmd; \ chmod +x bin/console; sync; -RUN yarn install --network-timeout 600000 && \ - yarn build && \ - yarn cache clean && \ - rm -rf node_modules/ +# Copy built frontend assets from node-builder stage +COPY --from=node-builder /app/public/build ./public/build # Use docker env to output logs to stdout ENV APP_ENV=docker From 4b77a07b1a1afcf85c2989f1719792d841d93d56 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 15:45:43 +0000 Subject: [PATCH 03/16] Fix node-builder stage with stub translations file Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com> --- Dockerfile | 35 ++++++++++++++++++++++------------- Dockerfile-frankenphp | 35 ++++++++++++++++++++++------------- 2 files changed, 44 insertions(+), 26 deletions(-) diff --git a/Dockerfile b/Dockerfile index 91dc86984..49dc40bcb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,10 +7,9 @@ FROM node:${NODE_VERSION}-bookworm-slim AS node-builder WORKDIR /app -# Install composer - needed for symfony UX packages +# Install composer and minimal PHP for running Symfony commands COPY --from=composer:latest /usr/bin/composer /usr/bin/composer -# Install minimal PHP for composer (only for installing dependencies) RUN apt-get update && apt-get install -y --no-install-recommends \ php-cli \ php-xml \ @@ -19,21 +18,31 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ git \ && apt-get clean && rm -rf /var/lib/apt/lists/* -# Copy composer files and install PHP dependencies (needed for Symfony UX assets) +# Copy composer files and install dependencies (needed for Symfony UX assets) COPY composer.json composer.lock symfony.lock ./ -RUN composer install --no-scripts --no-autoloader --no-dev --prefer-dist +RUN composer install --no-scripts --no-autoloader --no-dev --prefer-dist --ignore-platform-reqs -# Copy package files for better layer caching -COPY package.json yarn.lock ./ +# Copy all application files needed for cache warmup and webpack build +COPY .env* ./ +COPY bin ./bin +COPY config ./config +COPY src ./src +COPY translations ./translations +COPY public ./public +COPY assets ./assets +COPY webpack.config.js ./ -# Install node dependencies -RUN yarn install --network-timeout 600000 +# Generate autoloader +RUN composer dump-autoload -# Copy necessary files for the build -COPY webpack.config.js ./ -COPY assets ./assets -COPY public ./public -COPY translations ./translations +# Create stub translations file for webpack build (real translations will be generated in final image) +RUN mkdir -p var/translations && \ + echo 'export const messages = {};' > var/translations/index.js && \ + echo 'export const localeFallbacks = {};' >> var/translations/index.js + +# Copy package files and install node dependencies +COPY package.json yarn.lock ./ +RUN yarn install --network-timeout 600000 # Build the assets RUN yarn build diff --git a/Dockerfile-frankenphp b/Dockerfile-frankenphp index c3fccf40c..149cffea4 100644 --- a/Dockerfile-frankenphp +++ b/Dockerfile-frankenphp @@ -5,10 +5,9 @@ FROM node:${NODE_VERSION}-bookworm-slim AS node-builder WORKDIR /app -# Install composer - needed for symfony UX packages +# Install composer and minimal PHP for running Symfony commands COPY --from=composer:latest /usr/bin/composer /usr/bin/composer -# Install minimal PHP for composer (only for installing dependencies) RUN apt-get update && apt-get install -y --no-install-recommends \ php-cli \ php-xml \ @@ -17,21 +16,31 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ git \ && apt-get clean && rm -rf /var/lib/apt/lists/* -# Copy composer files and install PHP dependencies (needed for Symfony UX assets) +# Copy composer files and install dependencies (needed for Symfony UX assets) COPY composer.json composer.lock symfony.lock ./ -RUN composer install --no-scripts --no-autoloader --no-dev --prefer-dist +RUN composer install --no-scripts --no-autoloader --no-dev --prefer-dist --ignore-platform-reqs -# Copy package files for better layer caching -COPY package.json yarn.lock ./ +# Copy all application files needed for cache warmup and webpack build +COPY .env* ./ +COPY bin ./bin +COPY config ./config +COPY src ./src +COPY translations ./translations +COPY public ./public +COPY assets ./assets +COPY webpack.config.js ./ -# Install node dependencies -RUN yarn install --network-timeout 600000 +# Generate autoloader +RUN composer dump-autoload -# Copy necessary files for the build -COPY webpack.config.js ./ -COPY assets ./assets -COPY public ./public -COPY translations ./translations +# Create stub translations file for webpack build (real translations will be generated in final image) +RUN mkdir -p var/translations && \ + echo 'export const messages = {};' > var/translations/index.js && \ + echo 'export const localeFallbacks = {};' >> var/translations/index.js + +# Copy package files and install node dependencies +COPY package.json yarn.lock ./ +RUN yarn install --network-timeout 600000 # Build the assets RUN yarn build From ac4e3a556f4c34d280809a552e9db407eb0a602e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 15:49:30 +0000 Subject: [PATCH 04/16] Improve stub translations file creation using heredoc Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com> --- Dockerfile | 8 +++++--- Dockerfile-frankenphp | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 49dc40bcb..f245a85db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,9 +36,11 @@ COPY webpack.config.js ./ RUN composer dump-autoload # Create stub translations file for webpack build (real translations will be generated in final image) -RUN mkdir -p var/translations && \ - echo 'export const messages = {};' > var/translations/index.js && \ - echo 'export const localeFallbacks = {};' >> var/translations/index.js +RUN mkdir -p var/translations +COPY < var/translations/index.js && \ - echo 'export const localeFallbacks = {};' >> var/translations/index.js +RUN mkdir -p var/translations +COPY < Date: Sun, 15 Feb 2026 16:12:40 +0000 Subject: [PATCH 05/16] Build real translations in node-builder stage via cache warmup Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com> --- Dockerfile | 15 +++++++++------ Dockerfile-frankenphp | 15 +++++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index f245a85db..07ea8a6c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,12 +35,15 @@ COPY webpack.config.js ./ # Generate autoloader RUN composer dump-autoload -# Create stub translations file for webpack build (real translations will be generated in final image) -RUN mkdir -p var/translations -COPY < var/translations/index.js && \ + echo 'export const localeFallbacks = {};' >> var/translations/index.js) # Copy package files and install node dependencies COPY package.json yarn.lock ./ diff --git a/Dockerfile-frankenphp b/Dockerfile-frankenphp index 55a92b2ce..a02e69e81 100644 --- a/Dockerfile-frankenphp +++ b/Dockerfile-frankenphp @@ -33,12 +33,15 @@ COPY webpack.config.js ./ # Generate autoloader RUN composer dump-autoload -# Create stub translations file for webpack build (real translations will be generated in final image) -RUN mkdir -p var/translations -COPY < var/translations/index.js && \ + echo 'export const localeFallbacks = {};' >> var/translations/index.js) # Copy package files and install node dependencies COPY package.json yarn.lock ./ From d4ddc0d55564aee2e371a305eba02044107981f1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 16:17:11 +0000 Subject: [PATCH 06/16] Improve error handling for cache warmup fallback Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com> --- Dockerfile | 5 +++-- Dockerfile-frankenphp | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 07ea8a6c5..2b1b63055 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,8 +39,9 @@ RUN composer dump-autoload RUN mkdir -p var/cache var/log uploads public/media # Generate real translations via cache warmup (needed for webpack build) -RUN echo "yes" | php bin/console cache:warmup --env=prod || \ - (echo "Warning: Cache warmup failed, but continuing..." && \ +RUN echo "yes" | php bin/console cache:warmup --env=prod 2>&1 || \ + (echo "Warning: Cache warmup failed with exit code $?, but continuing..." && \ + echo "Falling back to stub translations..." && \ mkdir -p var/translations && \ echo 'export const messages = {};' > var/translations/index.js && \ echo 'export const localeFallbacks = {};' >> var/translations/index.js) diff --git a/Dockerfile-frankenphp b/Dockerfile-frankenphp index a02e69e81..05fd55c57 100644 --- a/Dockerfile-frankenphp +++ b/Dockerfile-frankenphp @@ -37,8 +37,9 @@ RUN composer dump-autoload RUN mkdir -p var/cache var/log uploads public/media # Generate real translations via cache warmup (needed for webpack build) -RUN echo "yes" | php bin/console cache:warmup --env=prod || \ - (echo "Warning: Cache warmup failed, but continuing..." && \ +RUN echo "yes" | php bin/console cache:warmup --env=prod 2>&1 || \ + (echo "Warning: Cache warmup failed with exit code $?, but continuing..." && \ + echo "Falling back to stub translations..." && \ mkdir -p var/translations && \ echo 'export const messages = {};' > var/translations/index.js && \ echo 'export const localeFallbacks = {};' >> var/translations/index.js) From df1d3fe8872b28b4468cc88cac38f33bb8f659a5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 16:47:53 +0000 Subject: [PATCH 07/16] Use native build platform for node-builder stage Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com> --- Dockerfile | 3 ++- Dockerfile-frankenphp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2b1b63055..3376f53fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,8 @@ ARG PHP_VERSION=8.4 ARG NODE_VERSION=22 # Node.js build stage for building frontend assets -FROM node:${NODE_VERSION}-bookworm-slim AS node-builder +# Use native platform for build stage as it's platform-independent +FROM --platform=$BUILDPLATFORM node:${NODE_VERSION}-bookworm-slim AS node-builder WORKDIR /app diff --git a/Dockerfile-frankenphp b/Dockerfile-frankenphp index 05fd55c57..5f6a4b029 100644 --- a/Dockerfile-frankenphp +++ b/Dockerfile-frankenphp @@ -1,7 +1,8 @@ ARG NODE_VERSION=22 # Node.js build stage for building frontend assets -FROM node:${NODE_VERSION}-bookworm-slim AS node-builder +# Use native platform for build stage as it's platform-independent +FROM --platform=$BUILDPLATFORM node:${NODE_VERSION}-bookworm-slim AS node-builder WORKDIR /app From 1f0d720ace71a35d71892324e79ef368bf6c22cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 15 Feb 2026 22:36:49 +0100 Subject: [PATCH 08/16] Do not include fallback for case that translations not exist --- Dockerfile | 9 ++------- Dockerfile-frankenphp | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3376f53fd..a5fab07d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,13 +39,8 @@ RUN composer dump-autoload # Create required directories for cache warmup RUN mkdir -p var/cache var/log uploads public/media -# Generate real translations via cache warmup (needed for webpack build) -RUN echo "yes" | php bin/console cache:warmup --env=prod 2>&1 || \ - (echo "Warning: Cache warmup failed with exit code $?, but continuing..." && \ - echo "Falling back to stub translations..." && \ - mkdir -p var/translations && \ - echo 'export const messages = {};' > var/translations/index.js && \ - echo 'export const localeFallbacks = {};' >> var/translations/index.js) +# Dump translations, which we need for cache warmup +RUN php bin/console cache:warmup -n --env=prod 2>&1 # Copy package files and install node dependencies COPY package.json yarn.lock ./ diff --git a/Dockerfile-frankenphp b/Dockerfile-frankenphp index 5f6a4b029..8b6fd95d6 100644 --- a/Dockerfile-frankenphp +++ b/Dockerfile-frankenphp @@ -37,13 +37,8 @@ RUN composer dump-autoload # Create required directories for cache warmup RUN mkdir -p var/cache var/log uploads public/media -# Generate real translations via cache warmup (needed for webpack build) -RUN echo "yes" | php bin/console cache:warmup --env=prod 2>&1 || \ - (echo "Warning: Cache warmup failed with exit code $?, but continuing..." && \ - echo "Falling back to stub translations..." && \ - mkdir -p var/translations && \ - echo 'export const messages = {};' > var/translations/index.js && \ - echo 'export const localeFallbacks = {};' >> var/translations/index.js) +# Dump translations, which we need for cache warmup +RUN php bin/console cache:warmup -n --env=prod 2>&1 # Copy package files and install node dependencies COPY package.json yarn.lock ./ From 5c958138546dba31e4796f9650819acdb502333a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 15 Feb 2026 23:55:16 +0100 Subject: [PATCH 09/16] Use newer format for dockerfile-frankenphp --- Dockerfile-frankenphp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile-frankenphp b/Dockerfile-frankenphp index 8b6fd95d6..b0d22bddf 100644 --- a/Dockerfile-frankenphp +++ b/Dockerfile-frankenphp @@ -135,8 +135,8 @@ VOLUME ["/var/www/html/uploads", "/var/www/html/public/media"] HEALTHCHECK --start-period=60s CMD curl -f http://localhost:2019/metrics || exit 1 # See https://caddyserver.com/docs/conventions#file-locations for details -ENV XDG_CONFIG_HOME /config -ENV XDG_DATA_HOME /data +ENV XDG_CONFIG_HOME=/config +ENV XDG_DATA_HOME=/data EXPOSE 80 EXPOSE 443 From 6c420fe40033c6307a58b63c39c09b984f73d081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Mon, 16 Feb 2026 11:32:12 +0100 Subject: [PATCH 10/16] Dockfile added caching to package managers --- Dockerfile | 65 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/Dockerfile b/Dockerfile index a5fab07d2..f56c9e8b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 ARG BASE_IMAGE=debian:bookworm-slim ARG PHP_VERSION=8.4 ARG NODE_VERSION=22 @@ -11,17 +12,23 @@ WORKDIR /app # Install composer and minimal PHP for running Symfony commands COPY --from=composer:latest /usr/bin/composer /usr/bin/composer -RUN apt-get update && apt-get install -y --no-install-recommends \ - php-cli \ - php-xml \ - php-mbstring \ - unzip \ - git \ +# Use BuildKit cache mounts for apt in builder stage +RUN --mount=type=cache,id=apt-cache-node,target=/var/cache/apt \ + --mount=type=cache,id=apt-lists-node,target=/var/lib/apt/lists \ + apt-get update && apt-get install -y --no-install-recommends \ + php-cli \ + php-xml \ + php-mbstring \ + unzip \ + git \ && apt-get clean && rm -rf /var/lib/apt/lists/* # Copy composer files and install dependencies (needed for Symfony UX assets) COPY composer.json composer.lock symfony.lock ./ -RUN composer install --no-scripts --no-autoloader --no-dev --prefer-dist --ignore-platform-reqs + +# Use BuildKit cache for Composer downloads +RUN --mount=type=cache,id=composer-cache,target=/root/.cache/composer \ + composer install --no-scripts --no-autoloader --no-dev --prefer-dist --ignore-platform-reqs # Copy all application files needed for cache warmup and webpack build COPY .env* ./ @@ -44,7 +51,10 @@ RUN php bin/console cache:warmup -n --env=prod 2>&1 # Copy package files and install node dependencies COPY package.json yarn.lock ./ -RUN yarn install --network-timeout 600000 +# Use BuildKit cache for yarn/npm +RUN --mount=type=cache,id=yarn-cache,target=/root/.cache/yarn \ + --mount=type=cache,id=npm-cache,target=/root/.npm \ + yarn install --network-timeout 600000 # Build the assets RUN yarn build @@ -56,12 +66,10 @@ RUN yarn cache clean && rm -rf node_modules/ FROM ${BASE_IMAGE} AS base ARG PHP_VERSION -# Install needed dependencies for PHP build -#RUN apt-get update && apt-get install -y pkg-config curl libcurl4-openssl-dev libicu-dev \ -# libpng-dev libjpeg-dev libfreetype6-dev gnupg zip libzip-dev libjpeg62-turbo-dev libonig-dev libxslt-dev libwebp-dev vim \ -# && apt-get -y autoremove && apt-get clean autoclean && rm -rf /var/lib/apt/lists/* - -RUN apt-get update && apt-get -y install \ +# Use BuildKit cache mounts for apt in base stage +RUN --mount=type=cache,id=apt-cache,target=/var/cache/apt \ + --mount=type=cache,id=apt-lists,target=/var/lib/apt/lists \ + apt-get update && apt-get -y install \ apt-transport-https \ lsb-release \ ca-certificates \ @@ -91,10 +99,8 @@ RUN apt-get update && apt-get -y install \ gpg \ sudo \ && apt-get -y autoremove && apt-get clean autoclean && rm -rf /var/lib/apt/lists/* \ -# Create workdir and set permissions if directory does not exists && mkdir -p /var/www/html \ && chown -R www-data:www-data /var/www/html \ -# delete the "index.html" that installing Apache drops in here && rm -rvf /var/www/html/* # Install composer @@ -110,14 +116,12 @@ ENV APACHE_ENVVARS=$APACHE_CONFDIR/envvars # : ${APACHE_RUN_USER:=www-data} # export APACHE_RUN_USER # so that they can be overridden at runtime ("-e APACHE_RUN_USER=...") -RUN sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS"; \ - set -eux; . "$APACHE_ENVVARS"; \ - \ - # logs should go to stdout / stderr - ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log"; \ - ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log"; \ - ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log"; \ - chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR"; +RUN sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS" && \ + set -eux; . "$APACHE_ENVVARS" && \ + ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log" && \ + ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log" && \ + ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log" && \ + chown -R --no-dereference "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$APACHE_LOG_DIR" # --- @@ -186,7 +190,6 @@ COPY --chown=www-data:www-data . . # Setup apache2 RUN a2dissite 000-default.conf && \ a2ensite symfony.conf && \ -# Enable php-fpm a2enmod proxy_fcgi setenvif && \ a2enconf php${PHP_VERSION}-fpm && \ a2enconf docker-php && \ @@ -194,7 +197,9 @@ RUN a2dissite 000-default.conf && \ # Install composer and yarn dependencies for Part-DB USER www-data -RUN composer install -a --no-dev && \ +# Use BuildKit cache for Composer when running as www-data by setting COMPOSER_CACHE_DIR +RUN --mount=type=cache,id=composer-cache,target=/tmp/.composer-cache \ + COMPOSER_CACHE_DIR=/tmp/.composer-cache composer install -a --no-dev && \ composer clear-cache # Copy built frontend assets from node-builder stage @@ -210,10 +215,12 @@ USER root RUN sed -i "s/PHP_VERSION/${PHP_VERSION}/g" ./.docker/partdb-entrypoint.sh # Copy entrypoint and apache2-foreground to /usr/local/bin and make it executable -RUN install ./.docker/partdb-entrypoint.sh /usr/local/bin && \ - install ./.docker/apache2-foreground /usr/local/bin +# Convert CRLF -> LF and install entrypoint scripts with executable mode +RUN sed -i 's/\r$//' ./.docker/partdb-entrypoint.sh ./.docker/apache2-foreground && \ + install -m 0755 ./.docker/partdb-entrypoint.sh /usr/local/bin/ && \ + install -m 0755 ./.docker/apache2-foreground /usr/local/bin/ ENTRYPOINT ["partdb-entrypoint.sh"] -CMD ["apache2-foreground"] +CMD ["/usr/local/bin/apache2-foreground"] # https://httpd.apache.org/docs/2.4/stopping.html#gracefulstop STOPSIGNAL SIGWINCH From 2ca588e5c6444d6ed530d00e76a146839f22d05f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Mon, 16 Feb 2026 11:46:15 +0100 Subject: [PATCH 11/16] Fixed frankenphp build --- .docker/frankenphp/conf.d/app.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.docker/frankenphp/conf.d/app.ini b/.docker/frankenphp/conf.d/app.ini index 10a062f29..08c71700e 100644 --- a/.docker/frankenphp/conf.d/app.ini +++ b/.docker/frankenphp/conf.d/app.ini @@ -12,7 +12,7 @@ opcache.max_accelerated_files = 20000 opcache.memory_consumption = 256 opcache.enable_file_override = 1 -memory_limit = 256M +memory_limit = 512M upload_max_filesize=256M -post_max_size=300M \ No newline at end of file +post_max_size=300M From 8407dced8b1bc4933e501e5e8e36430608ad82d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Mon, 16 Feb 2026 12:07:45 +0100 Subject: [PATCH 12/16] Fixed complain about missing symfony runtime --- .docker/frankenphp/worker.Caddyfile | 1 - 1 file changed, 1 deletion(-) diff --git a/.docker/frankenphp/worker.Caddyfile b/.docker/frankenphp/worker.Caddyfile index d384ae4cd..eaea18920 100644 --- a/.docker/frankenphp/worker.Caddyfile +++ b/.docker/frankenphp/worker.Caddyfile @@ -1,4 +1,3 @@ worker { file ./public/index.php - env APP_RUNTIME Runtime\FrankenPhpSymfony\Runtime } From 99ae6a51e2006791148b70fd6eb4db248091cf57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Mon, 16 Feb 2026 12:07:57 +0100 Subject: [PATCH 13/16] Use caching for frankenphp dockerfile --- Dockerfile-frankenphp | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/Dockerfile-frankenphp b/Dockerfile-frankenphp index b0d22bddf..e59121191 100644 --- a/Dockerfile-frankenphp +++ b/Dockerfile-frankenphp @@ -9,17 +9,23 @@ WORKDIR /app # Install composer and minimal PHP for running Symfony commands COPY --from=composer:latest /usr/bin/composer /usr/bin/composer -RUN apt-get update && apt-get install -y --no-install-recommends \ - php-cli \ - php-xml \ - php-mbstring \ - unzip \ - git \ +# Use BuildKit cache mounts for apt in builder stage +RUN --mount=type=cache,id=apt-cache-node,target=/var/cache/apt \ + --mount=type=cache,id=apt-lists-node,target=/var/lib/apt/lists \ + apt-get update && apt-get install -y --no-install-recommends \ + php-cli \ + php-xml \ + php-mbstring \ + unzip \ + git \ && apt-get clean && rm -rf /var/lib/apt/lists/* # Copy composer files and install dependencies (needed for Symfony UX assets) COPY composer.json composer.lock symfony.lock ./ -RUN composer install --no-scripts --no-autoloader --no-dev --prefer-dist --ignore-platform-reqs + +# Use BuildKit cache for Composer downloads +RUN --mount=type=cache,id=composer-cache,target=/root/.cache/composer \ + composer install --no-scripts --no-autoloader --no-dev --prefer-dist --ignore-platform-reqs # Copy all application files needed for cache warmup and webpack build COPY .env* ./ @@ -42,7 +48,12 @@ RUN php bin/console cache:warmup -n --env=prod 2>&1 # Copy package files and install node dependencies COPY package.json yarn.lock ./ -RUN yarn install --network-timeout 600000 + +# Use BuildKit cache for yarn/npm +RUN --mount=type=cache,id=yarn-cache,target=/root/.cache/yarn \ + --mount=type=cache,id=npm-cache,target=/root/.npm \ + yarn install --network-timeout 600000 + # Build the assets RUN yarn build @@ -53,7 +64,9 @@ RUN yarn cache clean && rm -rf node_modules/ # FrankenPHP base stage FROM dunglas/frankenphp:1-php8.4 AS frankenphp_upstream -RUN apt-get update && apt-get -y install \ +RUN --mount=type=cache,id=apt-cache,target=/var/cache/apt \ + --mount=type=cache,id=apt-lists,target=/var/lib/apt/lists \ + apt-get update && apt-get -y install \ curl \ ca-certificates \ mariadb-client \ @@ -111,7 +124,6 @@ COPY --link . ./ RUN set -eux; \ mkdir -p var/cache var/log; \ composer dump-autoload --classmap-authoritative --no-dev; \ - composer dump-env prod; \ composer run-script --no-dev post-install-cmd; \ chmod +x bin/console; sync; From a222939aa612c50b3f78844e7dc8b21a6019eeb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Mon, 16 Feb 2026 12:12:46 +0100 Subject: [PATCH 14/16] add target arch to dockerfile caches, to avoid problems --- Dockerfile | 8 ++++---- Dockerfile-frankenphp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index f56c9e8b9..0e1732471 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,8 +13,8 @@ WORKDIR /app COPY --from=composer:latest /usr/bin/composer /usr/bin/composer # Use BuildKit cache mounts for apt in builder stage -RUN --mount=type=cache,id=apt-cache-node,target=/var/cache/apt \ - --mount=type=cache,id=apt-lists-node,target=/var/lib/apt/lists \ +RUN --mount=type=cache,id=apt-cache-node-$TARGETARCH,target=/var/cache/apt \ + --mount=type=cache,id=apt-lists-node-$TARGETARCH,target=/var/lib/apt/lists \ apt-get update && apt-get install -y --no-install-recommends \ php-cli \ php-xml \ @@ -67,8 +67,8 @@ FROM ${BASE_IMAGE} AS base ARG PHP_VERSION # Use BuildKit cache mounts for apt in base stage -RUN --mount=type=cache,id=apt-cache,target=/var/cache/apt \ - --mount=type=cache,id=apt-lists,target=/var/lib/apt/lists \ +RUN --mount=type=cache,id=apt-cache-$TARGETARCH,target=/var/cache/apt \ + --mount=type=cache,id=apt-lists-$TARGETARCH,target=/var/lib/apt/lists \ apt-get update && apt-get -y install \ apt-transport-https \ lsb-release \ diff --git a/Dockerfile-frankenphp b/Dockerfile-frankenphp index e59121191..7525fb127 100644 --- a/Dockerfile-frankenphp +++ b/Dockerfile-frankenphp @@ -10,8 +10,8 @@ WORKDIR /app COPY --from=composer:latest /usr/bin/composer /usr/bin/composer # Use BuildKit cache mounts for apt in builder stage -RUN --mount=type=cache,id=apt-cache-node,target=/var/cache/apt \ - --mount=type=cache,id=apt-lists-node,target=/var/lib/apt/lists \ +RUN --mount=type=cache,id=apt-cache-node-$TARGETARCH,target=/var/cache/apt \ + --mount=type=cache,id=apt-lists-node-$TARGETARCH,target=/var/lib/apt/lists \ apt-get update && apt-get install -y --no-install-recommends \ php-cli \ php-xml \ @@ -64,8 +64,8 @@ RUN yarn cache clean && rm -rf node_modules/ # FrankenPHP base stage FROM dunglas/frankenphp:1-php8.4 AS frankenphp_upstream -RUN --mount=type=cache,id=apt-cache,target=/var/cache/apt \ - --mount=type=cache,id=apt-lists,target=/var/lib/apt/lists \ +RUN --mount=type=cache,id=apt-cache-$TARGETARCH,target=/var/cache/apt \ + --mount=type=cache,id=apt-lists-$TARGETARCH,target=/var/lib/apt/lists \ apt-get update && apt-get -y install \ curl \ ca-certificates \ From c8b5bb12d63de983fa3a8ca02bed5f6465bfd4ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Mon, 16 Feb 2026 12:15:12 +0100 Subject: [PATCH 15/16] add targetarch arg --- Dockerfile | 1 + Dockerfile-frankenphp | 1 + 2 files changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 0e1732471..077c8d69c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,7 @@ ARG BASE_IMAGE=debian:bookworm-slim ARG PHP_VERSION=8.4 ARG NODE_VERSION=22 +ARG TARGETARCH # Node.js build stage for building frontend assets # Use native platform for build stage as it's platform-independent diff --git a/Dockerfile-frankenphp b/Dockerfile-frankenphp index 7525fb127..ed3b2d116 100644 --- a/Dockerfile-frankenphp +++ b/Dockerfile-frankenphp @@ -1,4 +1,5 @@ ARG NODE_VERSION=22 +ARG TARGETARCH # Node.js build stage for building frontend assets # Use native platform for build stage as it's platform-independent From 43ac60c8fe0e2cb591e51cfe7818be5155075d4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Mon, 16 Feb 2026 12:17:37 +0100 Subject: [PATCH 16/16] moved targetarch argument to correct position --- Dockerfile | 5 ++--- Dockerfile-frankenphp | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 077c8d69c..e848acc10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,12 +2,10 @@ ARG BASE_IMAGE=debian:bookworm-slim ARG PHP_VERSION=8.4 ARG NODE_VERSION=22 -ARG TARGETARCH - # Node.js build stage for building frontend assets # Use native platform for build stage as it's platform-independent FROM --platform=$BUILDPLATFORM node:${NODE_VERSION}-bookworm-slim AS node-builder - +ARG TARGETARCH WORKDIR /app # Install composer and minimal PHP for running Symfony commands @@ -66,6 +64,7 @@ RUN yarn cache clean && rm -rf node_modules/ # Base stage for PHP FROM ${BASE_IMAGE} AS base ARG PHP_VERSION +ARG TARGETARCH # Use BuildKit cache mounts for apt in base stage RUN --mount=type=cache,id=apt-cache-$TARGETARCH,target=/var/cache/apt \ diff --git a/Dockerfile-frankenphp b/Dockerfile-frankenphp index ed3b2d116..4bf9eeeb4 100644 --- a/Dockerfile-frankenphp +++ b/Dockerfile-frankenphp @@ -1,10 +1,9 @@ ARG NODE_VERSION=22 -ARG TARGETARCH # Node.js build stage for building frontend assets # Use native platform for build stage as it's platform-independent FROM --platform=$BUILDPLATFORM node:${NODE_VERSION}-bookworm-slim AS node-builder - +ARG TARGETARCH WORKDIR /app # Install composer and minimal PHP for running Symfony commands @@ -64,7 +63,7 @@ RUN yarn cache clean && rm -rf node_modules/ # FrankenPHP base stage FROM dunglas/frankenphp:1-php8.4 AS frankenphp_upstream - +ARG TARGETARCH RUN --mount=type=cache,id=apt-cache-$TARGETARCH,target=/var/cache/apt \ --mount=type=cache,id=apt-lists-$TARGETARCH,target=/var/lib/apt/lists \ apt-get update && apt-get -y install \