diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 35d4b81..cb33f32 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -146,14 +146,7 @@ jobs: if: github.ref == 'refs/heads/main' with: tags: | - ghcr.io/shopware/docker-base:${{ matrix.php }}-caddy - ghcr.io/shopware/docker-base:${{ matrix.php }} - ghcr.io/shopware/docker-base:${{ matrix.phpPatch }}-caddy - ghcr.io/shopware/docker-base:${{ matrix.phpPatch }} - shopware/docker-base:${{ matrix.php }}-caddy - shopware/docker-base:${{ matrix.php }} - shopware/docker-base:${{ matrix.phpPatch }}-caddy - shopware/docker-base:${{ matrix.phpPatch }} + ${{ matrix.caddy-tags }} context: caddy cache-from: type=registry,ref=ghcr.io/shopware/docker-cache:${{ matrix.php }}-caddy cache-to: type=registry,ref=ghcr.io/shopware/docker-cache:${{ matrix.php }}-caddy,mode=max @@ -165,3 +158,47 @@ jobs: push: false provenance: false + check: + name: Test Image + runs-on: ubuntu-latest + needs: [caddy] + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Checkout + uses: actions/checkout@v4 + + - name: Checkout example repo + uses: actions/checkout@v4 + with: + path: example-repo + repository: shopwareLabs/example-docker-repository + + - name: Build + id: build + uses: docker/build-push-action@v5 + with: + push: false + load: true + build-arg: | + BASE_IMAGE=ghcr.io/shopware/docker-base:${{ github.run_id }}-8.3-caddy + context: . + file: 8.3/Dockerfile + cache-from: type=gha + cache-to: type=gha,mode=max + + - name: Run image + env: + DOCKER_BUILDKIT: 0 + working-directory: example-repo + run: docker compose up -d --wait + + - name: Check if shopware is running + run: curl --fail localhost:8000/admin + + # output logs if failed + - name: Output logs + working-directory: example-repo + run: docker compose logs + if: ${{ failure() }} \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml deleted file mode 100644 index 2d59b69..0000000 --- a/.github/workflows/pr.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Smoke test Image -on: - pull_request: - -jobs: - check: - name: Test Image - runs-on: ubuntu-latest - steps: - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Checkout - uses: actions/checkout@v4 - - - name: Checkout example repo - uses: actions/checkout@v4 - with: - path: example-repo - repository: shopwareLabs/example-docker-repository - - - name: Build - id: build - uses: docker/build-push-action@v5 - with: - push: false - load: true - tags: | - shopware/docker-base:8.3 - docker.io/shopware/docker-base:8.3 - context: . - file: 8.3/Dockerfile - cache-from: type=gha - cache-to: type=gha,mode=max - - - name: Run image - env: - DOCKER_BUILDKIT: 0 - working-directory: example-repo - run: docker compose up -d --wait - - - name: Check if shopware is running - run: curl --fail localhost:8000/admin - - # output logs if failed - - name: Output logs - working-directory: example-repo - run: docker compose logs - if: ${{ failure() }} diff --git a/matrix.php b/matrix.php index 6802f1e..9d13067 100644 --- a/matrix.php +++ b/matrix.php @@ -41,15 +41,33 @@ $imagePrefix = $_SERVER['GITHUB_RUN_ID'] ? ($_SERVER['GITHUB_RUN_ID'] . '-') : ''; + $caddyImages = [ + 'ghcr.io/shopware/docker-base:' . $imagePrefix . $supportedVersion, + 'ghcr.io/shopware/docker-base:' . $imagePrefix . $supportedVersion . '-caddy', + 'ghcr.io/shopware/docker-base:' . $imagePrefix . $patchVersion['version'], + 'ghcr.io/shopware/docker-base:' . $imagePrefix . $$patchVersion['version'] . '-caddy', + ]; + + if (!$imagePrefix) { + $caddyImages = array_merge($caddyImages, [ + 'shopware/docker-base:' . $imagePrefix . $supportedVersion, + 'shopware/docker-base:' . $imagePrefix . $supportedVersion . '-caddy', + 'shopware/docker-base:' . $imagePrefix . $patchVersion['version'], + 'shopware/docker-base:' . $imagePrefix . $patchVersion['version'] . '-caddy', + ]); + } + $data[] = [ 'php' => $supportedVersion, 'phpPatch' => $patchVersion['version'], 'phpPatchDigest' => $phpDigest, 'supervisordDigest' => $supervisord, + 'base-image' => 'ghcr.io/shopware/docker-base:' . $imagePrefix . $supportedVersion, 'fpm-image' => 'ghcr.io/shopware/docker-base:' . $imagePrefix . $supportedVersion . '-fpm', 'fpm-patch-image' => 'ghcr.io/shopware/docker-base:' . $imagePrefix . $patchVersion['version'] . '-fpm', 'fpm-hub-image' => 'shopware/docker-base:' . $imagePrefix . $supportedVersion . '-fpm', 'fpm-patch-hub-image' => 'shopware/docker-base:' . $imagePrefix . $patchVersion['version'] . '-fpm', + 'caddy-tags' => implode("\n", $caddyImages), ]; }