Added --platform=$BUILDPLATFORM to composer-deps and assets stages to ensure they run on the native build platform (amd64) instead of being built separately for each target architecture (amd64, arm64, arm/v7).
This is the critical change that makes the optimization work:
- Without this flag, Docker Buildx builds these stages for each target platform
- With this flag, stages run once on native platform and results are copied to all targets
- Eliminates ARM emulation overhead for CPU-intensive asset compilation
Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
Refactored to copy the entire project directory in composer-deps and assets stages instead of cherry-picking specific files. This:
- Eliminates the separate translations stage
- Avoids missing file issues
- Simplifies the build process
- Maintains performance benefit of building assets once on native platform
Both stages now use COPY . . to get all project files, avoiding the complexity of tracking which files are needed.
Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
Symfony console requires .env file to bootstrap. Added COPY .env to translations stage so cache:warmup can run successfully.
Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
Git is required by composer when installing packages from source. This dependency was exposed by the multi-stage build changes where composer-deps stage uses --no-scripts and the final stage needs to complete the installation.
Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
The assets are copied while running as www-data user, so the --chown flag is redundant. This makes it consistent with the frankenphp version.
Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
- Add multi-stage build with separate composer-deps and assets stages
- Assets are built once on native platform (node:22-bookworm-slim)
- Pre-built assets copied into final images for all platforms
- Remove Node.js/Yarn installation from final images (smaller size)
- Use --ignore-platform-reqs for composer in assets stage
- Applies to both Dockerfile and Dockerfile-frankenphp
Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
* reorder nodejs/yarn install, separate packages per line
* reduce run actions and reorganize commands
* simplify file creation, copy in one layer only
* fix lint LegacyKeyValueFormat
* arg php_version to run different version
* reorder copy from generated config
* update dockerfile-frankenphp
An error with the test container will be coming to 4.4.1 (which is not released yet). When it is available we should revert the changes to composer.json.