diff --git a/.github/workflows/build-fpm.yml b/.github/workflows/build-v1-fpm.yml similarity index 85% rename from .github/workflows/build-fpm.yml rename to .github/workflows/build-v1-fpm.yml index 6470910..5c2bd76 100644 --- a/.github/workflows/build-fpm.yml +++ b/.github/workflows/build-v1-fpm.yml @@ -1,32 +1,22 @@ -name: Build FPM Images +name: Build v1 FPM Images on: workflow_dispatch: push: branches: - main paths: - - 'docker-bake.hcl' - - 'docker-bake.fpm.hcl' - - '.github/workflows/build-fpm.yml' + - 'v1/docker-bake.hcl' + - '.github/workflows/build-v1-fpm.yml' - '.github/action/build-bake-publish/**' - '.github/action/setup-builder/**' - - 'fpm/**' - - 'fpm-otel/**' - - 'caddy/**' - - 'nginx/**' - - 'dev/**' + - 'v1/fpm/**' pull_request: paths: - - 'docker-bake.hcl' - - 'docker-bake.fpm.hcl' - - '.github/workflows/build-fpm.yml' + - 'v1/docker-bake.hcl' + - '.github/workflows/build-v1-fpm.yml' - '.github/action/build-bake-publish/**' - '.github/action/setup-builder/**' - - 'fpm/**' - - 'fpm-otel/**' - - 'caddy/**' - - 'nginx/**' - - 'dev/**' + - 'v1/fpm/**' schedule: - cron: '10 4 * * *' @@ -60,7 +50,7 @@ jobs: - name: Read PHP versions from Bake id: matrix run: | - matrix=$(docker buildx bake -f docker-bake.hcl -f docker-bake.fpm.hcl --print fpm | jq -c '{include: [.group.fpm.targets[] | ltrimstr("fpm-") | {php: gsub("-"; "."), suffix: .}]}') + matrix=$(docker buildx bake -f v1/docker-bake.hcl -f v1/fpm/docker-bake.hcl --print fpm | jq -c '{include: [.group.fpm.targets[] | ltrimstr("fpm-") | {php: gsub("-"; "."), suffix: .}]}') echo "matrix=$matrix" >> "$GITHUB_OUTPUT" fpm: @@ -85,8 +75,8 @@ jobs: uses: ./.github/action/build-bake-publish with: files: | - docker-bake.hcl - docker-bake.fpm.hcl + v1/docker-bake.hcl + v1/fpm/docker-bake.hcl targets: fpm-${{ matrix.suffix }} github_token: ${{ secrets.GITHUB_TOKEN }} @@ -94,8 +84,8 @@ jobs: uses: ./.github/action/build-bake-publish with: files: | - docker-bake.hcl - docker-bake.fpm.hcl + v1/docker-bake.hcl + v1/fpm/docker-bake.hcl targets: fpm-otel-${{ matrix.suffix }} github_token: ${{ secrets.GITHUB_TOKEN }} @@ -103,8 +93,8 @@ jobs: uses: ./.github/action/build-bake-publish with: files: | - docker-bake.hcl - docker-bake.fpm.hcl + v1/docker-bake.hcl + v1/fpm/docker-bake.hcl targets: | caddy-${{ matrix.suffix }} nginx-${{ matrix.suffix }} @@ -114,8 +104,8 @@ jobs: uses: ./.github/action/build-bake-publish with: files: | - docker-bake.hcl - docker-bake.fpm.hcl + v1/docker-bake.hcl + v1/fpm/docker-bake.hcl targets: | caddy-otel-${{ matrix.suffix }} nginx-otel-${{ matrix.suffix }} @@ -144,8 +134,8 @@ jobs: uses: ./.github/action/build-bake-publish with: files: | - docker-bake.hcl - docker-bake.fpm.hcl + v1/docker-bake.hcl + v1/fpm/docker-bake.hcl targets: ${{ matrix.webserver }}-dev github_token: ${{ secrets.GITHUB_TOKEN }} @@ -178,7 +168,7 @@ jobs: run: docker pull ${{ steps.image-tag.outputs.IMAGE_TAG }} - name: Test Dev Image - run: container-structure-test test --config dev/config.yaml --image ${{ steps.image-tag.outputs.IMAGE_TAG }} + run: container-structure-test test --config v1/fpm/dev/config.yaml --image ${{ steps.image-tag.outputs.IMAGE_TAG }} check: name: Test Image with Webserver ${{ matrix.webserver }} diff --git a/.github/workflows/build-frankenphp.yml b/.github/workflows/build-v1-frankenphp.yml similarity index 73% rename from .github/workflows/build-frankenphp.yml rename to .github/workflows/build-v1-frankenphp.yml index bebed6f..c016953 100644 --- a/.github/workflows/build-frankenphp.yml +++ b/.github/workflows/build-v1-frankenphp.yml @@ -1,26 +1,22 @@ -name: Build FrankenPHP Images +name: Build v1 FrankenPHP Images on: workflow_dispatch: push: branches: - main paths: - - 'docker-bake.hcl' - - 'docker-bake.frankenphp.hcl' - - '.github/workflows/build-frankenphp.yml' + - 'v1/docker-bake.hcl' + - '.github/workflows/build-v1-frankenphp.yml' - '.github/action/build-bake-publish/**' - '.github/action/setup-builder/**' - - 'frankenphp/**' - - 'frankenphp-otel/**' + - 'v1/frankenphp/**' pull_request: paths: - - 'docker-bake.hcl' - - 'docker-bake.frankenphp.hcl' - - '.github/workflows/build-frankenphp.yml' + - 'v1/docker-bake.hcl' + - '.github/workflows/build-v1-frankenphp.yml' - '.github/action/build-bake-publish/**' - '.github/action/setup-builder/**' - - 'frankenphp/**' - - 'frankenphp-otel/**' + - 'v1/frankenphp/**' schedule: - cron: '10 4 * * *' @@ -54,7 +50,7 @@ jobs: - name: Read PHP versions from Bake id: matrix run: | - matrix=$(docker buildx bake -f docker-bake.hcl -f docker-bake.frankenphp.hcl --print frankenphp | jq -c '{include: [.group.frankenphp.targets[] | ltrimstr("frankenphp-") | {php: gsub("-"; "."), suffix: .}]}') + matrix=$(docker buildx bake -f v1/docker-bake.hcl -f v1/frankenphp/docker-bake.hcl --print frankenphp | jq -c '{include: [.group.frankenphp.targets[] | ltrimstr("frankenphp-") | {php: gsub("-"; "."), suffix: .}]}') echo "matrix=$matrix" >> "$GITHUB_OUTPUT" frankenphp: @@ -79,8 +75,8 @@ jobs: uses: ./.github/action/build-bake-publish with: files: | - docker-bake.hcl - docker-bake.frankenphp.hcl + v1/docker-bake.hcl + v1/frankenphp/docker-bake.hcl targets: frankenphp-${{ matrix.suffix }} github_token: ${{ secrets.GITHUB_TOKEN }} @@ -88,7 +84,7 @@ jobs: uses: ./.github/action/build-bake-publish with: files: | - docker-bake.hcl - docker-bake.frankenphp.hcl + v1/docker-bake.hcl + v1/frankenphp/docker-bake.hcl targets: frankenphp-otel-${{ matrix.suffix }} github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/hub.yml b/.github/workflows/hub.yml deleted file mode 100644 index ec7e2d0..0000000 --- a/.github/workflows/hub.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Sync Dockerhub Readme -on: - workflow_dispatch: - push: - branches: - - main - paths: - - README.md - -jobs: - sync: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v7 - - - name: Docker Hub Description - uses: peter-evans/dockerhub-description@v5 - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_PASSWORD }} - repository: shopware/docker-base diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index f3ccf0c..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Lint Dockerfile -on: - workflow_dispatch: - pull_request: - paths: - - "Dockerfile.template" - push: - paths: - - "Dockerfile.template" - -jobs: - lint: - name: Lint Dockerfiles - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v7 - - - name: Lint FPM - uses: hadolint/hadolint-action@master - with: - dockerfile: ./fpm/Dockerfile - ignore: DL3018 - - - name: Lint Caddy - uses: hadolint/hadolint-action@master - with: - dockerfile: ./caddy/Dockerfile - ignore: DL3018 diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml index 7713edf..4601e92 100644 --- a/.github/workflows/security.yml +++ b/.github/workflows/security.yml @@ -22,21 +22,21 @@ jobs: - '8.5' variant: - name: fpm - dockerfile: fpm/Dockerfile + dockerfile: v1/fpm/Dockerfile - name: fpm-otel - dockerfile: fpm-otel/Dockerfile + dockerfile: v1/fpm/otel/Dockerfile - name: caddy - dockerfile: caddy/Dockerfile + dockerfile: v1/fpm/caddy/Dockerfile - name: caddy-otel - dockerfile: caddy/Dockerfile + dockerfile: v1/fpm/caddy/Dockerfile - name: nginx - dockerfile: nginx/Dockerfile + dockerfile: v1/fpm/nginx/Dockerfile - name: nginx-otel - dockerfile: nginx/Dockerfile + dockerfile: v1/fpm/nginx/Dockerfile - name: frankenphp - dockerfile: frankenphp/Dockerfile + dockerfile: v1/frankenphp/Dockerfile - name: frankenphp-otel - dockerfile: frankenphp-otel/Dockerfile + dockerfile: v1/frankenphp/otel/Dockerfile steps: - name: Checkout uses: actions/checkout@v7 diff --git a/.github/workflows/shell-lint.yml b/.github/workflows/shell-lint.yml deleted file mode 100644 index c720163..0000000 --- a/.github/workflows/shell-lint.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Shellcheck -on: - pull_request: - paths: - - "rootfs/setup*" - -permissions: - contents: read - -jobs: - lint: - name: Shell Lint - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v7 - - - name: Run ShellCheck - uses: ludeeus/action-shellcheck@master diff --git a/.github/workflows/update-php-matrix.yml b/.github/workflows/update-php-matrix.yml index 562c10a..16fd3e2 100644 --- a/.github/workflows/update-php-matrix.yml +++ b/.github/workflows/update-php-matrix.yml @@ -27,7 +27,7 @@ jobs: token: ${{ steps.generate-token.outputs.token }} - name: Run PHP matrix update script - run: node update-php-matrix.mjs + run: node scripts/update-php-matrix.mjs - name: Check for changes id: changes @@ -52,8 +52,8 @@ jobs: This PR automatically updates the PHP matrix versions to the latest patch releases. The family-specific Bake files have been updated: - - `docker-bake.fpm.hcl`: Supported PHP patch versions - - `docker-bake.frankenphp.hcl`: Supported FrankenPHP patch versions + - `v1/fpm/docker-bake.hcl`: Supported PHP patch versions + - `v1/frankenphp/docker-bake.hcl`: Supported FrankenPHP patch versions Changes were detected by the automated PHP matrix update workflow. diff --git a/README.md b/README.md index f779e91..f1e5322 100644 --- a/README.md +++ b/README.md @@ -6,15 +6,43 @@ This repository contains a base image with Alpine + PHP + (Caddy or Nginx), whic The Nginx, Caddy and FrankenPHP configurations send `script-src 'none'; object-src 'none'; frame-src 'none'; base-uri 'none'; form-action 'none'` for static SVG files and existing HTML files under `public/media` and `public/thumbnail`. Application-rendered HTML and bundled HTML applications retain their own response policies. Custom static documents must work without scripts, embedded documents, base URL overrides or form submissions; images and styles remain permitted. Development images inherit the corresponding server configuration. +## Repository layout + +Image generations live in their own top-level directories. The existing images +live in `v1/`; future calendar versions, such as `v2026.1/`, can coexist alongside +them with their own build definitions and configuration. + +```text +v1/ +├── docker-bake.hcl # Shared v1 variables +├── fpm/ +│ ├── docker-bake.hcl # FPM and derived image targets +│ ├── Dockerfile +│ ├── rootfs/ +│ ├── otel/ +│ ├── caddy/ +│ ├── nginx/ +│ └── dev/ # Shared by the Caddy and Nginx dev images +└── frankenphp/ + ├── docker-bake.hcl + ├── Dockerfile + ├── rootfs/ + └── otel/ +``` + +Shared automation lives in `.github/` and `scripts/`. The directory names do not +change the published image tags: v1 images keep their existing unversioned tags. + ## Building images -Bake settings are split into shared variables in `docker-bake.hcl` and targets -in `docker-bake.fpm.hcl` and `docker-bake.frankenphp.hcl`. Load the shared file -alongside the family you want to build: +Bake settings are split into shared variables in `v1/docker-bake.hcl` and targets +in `v1/fpm/docker-bake.hcl` and `v1/frankenphp/docker-bake.hcl`. Load the shared file +alongside the family you want to build. Run these commands from the repository +root, since Bake resolves build contexts relative to the working directory: ```sh -docker buildx bake -f docker-bake.hcl -f docker-bake.fpm.hcl fpm -docker buildx bake -f docker-bake.hcl -f docker-bake.frankenphp.hcl frankenphp +docker buildx bake -f v1/docker-bake.hcl -f v1/fpm/docker-bake.hcl fpm +docker buildx bake -f v1/docker-bake.hcl -f v1/frankenphp/docker-bake.hcl frankenphp ``` FPM targets include `fpm`, `fpm-otel`, `caddy`, `caddy-otel`, `nginx`, @@ -27,3 +55,6 @@ push it before building its dependents, as the CI workflows do. The FPM and FrankenPHP workflows build independently when their files change. Changes to shared Bake settings or the publishing action trigger both families. Both workflows also support manual runs and daily rebuilds. + +Run `node scripts/update-php-matrix.mjs` from the repository root to update the +PHP patch versions in the family-specific Bake files. diff --git a/update-php-matrix.mjs b/scripts/update-php-matrix.mjs similarity index 96% rename from update-php-matrix.mjs rename to scripts/update-php-matrix.mjs index 92ab1d5..fcf5ff9 100755 --- a/update-php-matrix.mjs +++ b/scripts/update-php-matrix.mjs @@ -78,8 +78,8 @@ function getLatestFrankenphpPatchVersion(apiResponse) { // Function to update the PHP matrices in the family-specific Bake files async function updatePhpMatrixInHcl(phpVersions, frankenphpVersions) { const updates = [ - ['docker-bake.fpm.hcl', 'phpMatrix', phpVersions], - ['docker-bake.frankenphp.hcl', 'frankenphpMatrix', frankenphpVersions], + ['v1/fpm/docker-bake.hcl', 'phpMatrix', phpVersions], + ['v1/frankenphp/docker-bake.hcl', 'frankenphpMatrix', frankenphpVersions], ]; for (const [hclPath, name, versions] of updates) { diff --git a/docker-bake.hcl b/v1/docker-bake.hcl similarity index 50% rename from docker-bake.hcl rename to v1/docker-bake.hcl index d7805c6..4deee60 100644 --- a/docker-bake.hcl +++ b/v1/docker-bake.hcl @@ -1,4 +1,4 @@ -# Shared settings; load with docker-bake.fpm.hcl or docker-bake.frankenphp.hcl. +# Shared settings; load with v1/fpm/docker-bake.hcl or v1/frankenphp/docker-bake.hcl. variable "imageSuffix" { default = "" diff --git a/fpm/Dockerfile b/v1/fpm/Dockerfile similarity index 100% rename from fpm/Dockerfile rename to v1/fpm/Dockerfile diff --git a/caddy/Dockerfile b/v1/fpm/caddy/Dockerfile similarity index 100% rename from caddy/Dockerfile rename to v1/fpm/caddy/Dockerfile diff --git a/caddy/rootfs/etc/caddy/Caddyfile b/v1/fpm/caddy/rootfs/etc/caddy/Caddyfile similarity index 100% rename from caddy/rootfs/etc/caddy/Caddyfile rename to v1/fpm/caddy/rootfs/etc/caddy/Caddyfile diff --git a/caddy/rootfs/etc/supervisord.conf b/v1/fpm/caddy/rootfs/etc/supervisord.conf similarity index 100% rename from caddy/rootfs/etc/supervisord.conf rename to v1/fpm/caddy/rootfs/etc/supervisord.conf diff --git a/dev/Dockerfile b/v1/fpm/dev/Dockerfile similarity index 100% rename from dev/Dockerfile rename to v1/fpm/dev/Dockerfile diff --git a/dev/config.yaml b/v1/fpm/dev/config.yaml similarity index 100% rename from dev/config.yaml rename to v1/fpm/dev/config.yaml diff --git a/dev/rootfs/entrypoint b/v1/fpm/dev/rootfs/entrypoint similarity index 100% rename from dev/rootfs/entrypoint rename to v1/fpm/dev/rootfs/entrypoint diff --git a/dev/rootfs/etc/bash/bashrc b/v1/fpm/dev/rootfs/etc/bash/bashrc similarity index 100% rename from dev/rootfs/etc/bash/bashrc rename to v1/fpm/dev/rootfs/etc/bash/bashrc diff --git a/dev/rootfs/usr/local/bin/new-shopware-setup b/v1/fpm/dev/rootfs/usr/local/bin/new-shopware-setup similarity index 100% rename from dev/rootfs/usr/local/bin/new-shopware-setup rename to v1/fpm/dev/rootfs/usr/local/bin/new-shopware-setup diff --git a/docker-bake.fpm.hcl b/v1/fpm/docker-bake.hcl similarity index 96% rename from docker-bake.fpm.hcl rename to v1/fpm/docker-bake.hcl index ff136ba..35dbcb9 100644 --- a/docker-bake.fpm.hcl +++ b/v1/fpm/docker-bake.hcl @@ -6,7 +6,7 @@ variable "phpMatrix" { target "fpm" { name = "fpm-${replace(substr(php, 0, 3), ".", "-")}" - context = "./fpm" + context = "./v1/fpm" matrix = { "php" = phpMatrix } @@ -28,7 +28,7 @@ target "fpm" { target "fpm-otel" { name = "fpm-otel-${replace(substr(php, 0, 3), ".", "-")}" - context = "./fpm-otel" + context = "./v1/fpm/otel" matrix = { "php" = phpMatrix } @@ -52,7 +52,7 @@ target "fpm-otel" { target "caddy" { name = "caddy-${replace(substr(php, 0, 3), ".", "-")}" - context = "./caddy" + context = "./v1/fpm/caddy" matrix = { "php" = phpMatrix } @@ -74,7 +74,7 @@ target "caddy" { target "caddy-otel" { name = "caddy-otel-${replace(substr(php, 0, 3), ".", "-")}" - context = "./caddy" + context = "./v1/fpm/caddy" matrix = { "php" = phpMatrix } @@ -96,7 +96,7 @@ target "caddy-otel" { target "caddy-dev" { name = "caddy-dev-${replace(substr(php, 0, 3), ".", "-")}-${node}" - context = "./dev" + context = "./v1/fpm/dev" matrix = { "php" = phpMatrix "node" = [ "22", "24" ] @@ -118,7 +118,7 @@ target "caddy-dev" { target "nginx" { name = "nginx-${replace(substr(php, 0, 3), ".", "-")}" - context = "./nginx" + context = "./v1/fpm/nginx" matrix = { "php" = phpMatrix } @@ -140,7 +140,7 @@ target "nginx" { target "nginx-otel" { name = "nginx-otel-${replace(substr(php, 0, 3), ".", "-")}" - context = "./nginx" + context = "./v1/fpm/nginx" matrix = { "php" = phpMatrix } @@ -162,7 +162,7 @@ target "nginx-otel" { target "nginx-dev" { name = "nginx-dev-${replace(substr(php, 0, 3), ".", "-")}-${node}" - context = "./dev" + context = "./v1/fpm/dev" matrix = { "php" = phpMatrix "node" = [ "22", "24" ] diff --git a/nginx/Dockerfile b/v1/fpm/nginx/Dockerfile similarity index 100% rename from nginx/Dockerfile rename to v1/fpm/nginx/Dockerfile diff --git a/nginx/rootfs/etc/nginx/nginx.conf b/v1/fpm/nginx/rootfs/etc/nginx/nginx.conf similarity index 100% rename from nginx/rootfs/etc/nginx/nginx.conf rename to v1/fpm/nginx/rootfs/etc/nginx/nginx.conf diff --git a/nginx/rootfs/etc/supervisord.conf b/v1/fpm/nginx/rootfs/etc/supervisord.conf similarity index 100% rename from nginx/rootfs/etc/supervisord.conf rename to v1/fpm/nginx/rootfs/etc/supervisord.conf diff --git a/fpm-otel/Dockerfile b/v1/fpm/otel/Dockerfile similarity index 100% rename from fpm-otel/Dockerfile rename to v1/fpm/otel/Dockerfile diff --git a/fpm/rootfs/setup b/v1/fpm/rootfs/setup similarity index 100% rename from fpm/rootfs/setup rename to v1/fpm/rootfs/setup diff --git a/fpm/rootfs/usr/local/etc/php-fpm.d/docker.conf b/v1/fpm/rootfs/usr/local/etc/php-fpm.d/docker.conf similarity index 100% rename from fpm/rootfs/usr/local/etc/php-fpm.d/docker.conf rename to v1/fpm/rootfs/usr/local/etc/php-fpm.d/docker.conf diff --git a/fpm/rootfs/usr/local/etc/php/conf.d/docker.ini b/v1/fpm/rootfs/usr/local/etc/php/conf.d/docker.ini similarity index 100% rename from fpm/rootfs/usr/local/etc/php/conf.d/docker.ini rename to v1/fpm/rootfs/usr/local/etc/php/conf.d/docker.ini diff --git a/frankenphp/Dockerfile b/v1/frankenphp/Dockerfile similarity index 100% rename from frankenphp/Dockerfile rename to v1/frankenphp/Dockerfile diff --git a/docker-bake.frankenphp.hcl b/v1/frankenphp/docker-bake.hcl similarity index 96% rename from docker-bake.frankenphp.hcl rename to v1/frankenphp/docker-bake.hcl index 47cd6bd..7102ded 100644 --- a/docker-bake.frankenphp.hcl +++ b/v1/frankenphp/docker-bake.hcl @@ -6,7 +6,7 @@ variable "frankenphpMatrix" { target "frankenphp" { name = "frankenphp-${replace(substr(php, 0, 3), ".", "-")}" - context = "./frankenphp" + context = "./v1/frankenphp" matrix = { "php" = frankenphpMatrix } @@ -28,7 +28,7 @@ target "frankenphp" { target "frankenphp-otel" { name = "frankenphp-otel-${replace(substr(php, 0, 3), ".", "-")}" - context = "./frankenphp-otel" + context = "./v1/frankenphp/otel" matrix = { "php" = frankenphpMatrix } diff --git a/frankenphp-otel/Dockerfile b/v1/frankenphp/otel/Dockerfile similarity index 100% rename from frankenphp-otel/Dockerfile rename to v1/frankenphp/otel/Dockerfile diff --git a/frankenphp/rootfs/etc/caddy/Caddyfile b/v1/frankenphp/rootfs/etc/caddy/Caddyfile similarity index 100% rename from frankenphp/rootfs/etc/caddy/Caddyfile rename to v1/frankenphp/rootfs/etc/caddy/Caddyfile diff --git a/frankenphp/rootfs/setup b/v1/frankenphp/rootfs/setup similarity index 100% rename from frankenphp/rootfs/setup rename to v1/frankenphp/rootfs/setup diff --git a/frankenphp/rootfs/usr/local/etc/php/conf.d/docker.ini b/v1/frankenphp/rootfs/usr/local/etc/php/conf.d/docker.ini similarity index 100% rename from frankenphp/rootfs/usr/local/etc/php/conf.d/docker.ini rename to v1/frankenphp/rootfs/usr/local/etc/php/conf.d/docker.ini