From a5077285e332aa2fe49ebcf269985ffea894ea71 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Thu, 1 Aug 2024 14:44:06 +0200 Subject: [PATCH 1/4] feat: use deployment helper when available --- composer.json | 13 ++++++++----- fpm/rootfs/setup | 19 ++++++++++++++++++- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 0396315..94032b6 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,9 @@ { - "name": "shopware/docker", - "type": "metapackage", - "license": "MIT", - "description": "Docker image for Shopware 6 production" -} \ No newline at end of file + "name": "shopware/docker", + "type": "metapackage", + "license": "MIT", + "description": "Docker image for Shopware 6 production", + "require": { + "shopware/deployment-helper": "*" + } +} diff --git a/fpm/rootfs/setup b/fpm/rootfs/setup index b942b0c..a677197 100755 --- a/fpm/rootfs/setup +++ b/fpm/rootfs/setup @@ -1,8 +1,25 @@ #!/usr/bin/env sh set -e -set -x +if [[ -e /var/www/html/vendor/bin/shopware-deployment-helper ]]; then + cd /var/www/html + exec /var/www/html/vendor/bin/shopware-deployment-helper run +fi + +echo "### DEPRECATION ###" +echo "" +echo "### The setup scripts are deprecated and will be removed November 2024 ###" +echo "### Please install the Shopware Deployment Helper using composer require shopware/deployment-helper to get rid of this message ###" +echo "### For more information see https://developer.shopware.com/docs/guides/hosting/installation-updates/deployments/deployment-helper.html ###" +echo "" +echo "### DEPRECATION ###" +echo "" +echo "Sleeping 30 seconds to make the deprecation visible." + +sleep 30 + +set -x shopware_version=$(jq '.packages[] | select (.name == "shopware/core") | .version' -r < composer.lock) # shellcheck disable=SC2081,SC3010 From f09c561d7d7b6991a570a146654061e8fa3cb007 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Thu, 1 Aug 2024 16:00:09 +0200 Subject: [PATCH 2/4] ci: improve caddy build --- .github/workflows/build.yml | 21 +++++++-------------- caddy/Dockerfile | 4 ++-- matrix.php | 3 --- 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dd52e67..89a397d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -166,9 +166,7 @@ jobs: cache-to: type=registry,ref=ghcr.io/shopware/docker-cache:${{ matrix.php }}-caddy,mode=max platforms: linux/amd64,linux/arm64 build-args: | - PHP_PATCH_VERSION=${{ matrix.phpPatch }} - PHP_DIGEST=${{ matrix.phpPatchDigest }} - SUPERVISORD_DIGEST=${{ matrix.supervisordDigest }} + FPM_IMAGE=${{ matrix.fpm-image }} push: true provenance: false @@ -199,17 +197,12 @@ jobs: repository: shopwareLabs/example-docker-repository - name: Build - id: build - uses: docker/build-push-action@v6 - with: - push: false - load: true - build-args: | - BASE_IMAGE=ghcr.io/shopware/docker-base-ci-test:${{ github.run_id }}-8.3-caddy - context: . - file: Dockerfile - cache-from: type=gha - cache-to: type=gha,mode=max + run: docker compose build --build-arg BASE_IMAGE=ghcr.io/shopware/docker-base-ci-test:${{ github.run_id }}-8.3-caddy + env: + DOCKER_BUILDKIT: 0 + + - name: Sleep + run: sleep 10 - name: Run image env: diff --git a/caddy/Dockerfile b/caddy/Dockerfile index 5fe1753..5a8eeb3 100644 --- a/caddy/Dockerfile +++ b/caddy/Dockerfile @@ -1,8 +1,8 @@ #syntax=docker/dockerfile:1.4 -ARG PHP_PATCH_VERSION +ARG FPM_IMAGE=ghcr.io/shopware/docker-base:8.3.1-fpm -FROM ghcr.io/shopware/docker-base:${PHP_PATCH_VERSION}-fpm +FROM ${FPM_IMAGE} USER root diff --git a/matrix.php b/matrix.php index 99f42c5..231c132 100644 --- a/matrix.php +++ b/matrix.php @@ -28,8 +28,6 @@ function get_digest_of_image(string $imageName, string $tag): string { $versionRegex ='/^(?\d\.\d\.\d{1,}(RC\d)?)/m'; -$supervisord = get_digest_of_image('shyim/supervisord', 'latest'); - foreach ($supportedVersions as $supportedVersion) { @@ -100,7 +98,6 @@ function get_digest_of_image(string $imageName, string $tag): string { 'php' => $supportedVersion, 'phpPatch' => $patchVersion['version'], 'phpPatchDigest' => $phpDigest, - 'supervisordDigest' => $supervisord, 'base-image' => 'ghcr.io/shopware/docker-base' . $imageSuffix . ':' . $imageTagPrefix . $supportedVersion, 'fpm-image' => 'ghcr.io/shopware/docker-base' . $imageSuffix . ':' . $imageTagPrefix . $supportedVersion . '-fpm', 'fpm-patch-image' => 'ghcr.io/shopware/docker-base' . $imageSuffix . ':' . $imageTagPrefix . $patchVersion['version'] . '-fpm', From 17184618022b17edc00c736b11679af835f5fc93 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Fri, 2 Aug 2024 10:57:35 +0200 Subject: [PATCH 3/4] add debugging --- .github/workflows/build.yml | 16 ++++++++++++++++ fpm/rootfs/setup | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 89a397d..7d5704b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -209,6 +209,22 @@ jobs: DOCKER_BUILDKIT: 0 run: docker compose up -d --wait + - name: Wait for Webserver reachable + run: | + attempt_counter=0 + max_attempts=5 + + until $(curl --output /dev/null --silent --head --fail localhost:8000/admin); do + if [ ${attempt_counter} -eq ${max_attempts} ];then + echo "Max attempts reached" + exit 1 + fi + + printf '.' + attempt_counter=$(($attempt_counter+1)) + sleep 5 + done + - name: Check if shopware is running run: curl --fail localhost:8000/admin diff --git a/fpm/rootfs/setup b/fpm/rootfs/setup index a677197..ce193aa 100755 --- a/fpm/rootfs/setup +++ b/fpm/rootfs/setup @@ -4,7 +4,7 @@ set -e if [[ -e /var/www/html/vendor/bin/shopware-deployment-helper ]]; then cd /var/www/html - exec /var/www/html/vendor/bin/shopware-deployment-helper run + exec ./vendor/bin/shopware-deployment-helper run fi echo "### DEPRECATION ###" From faf8a8699e4cee3409f3ac4491639d155b57f3ce Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Fri, 2 Aug 2024 11:31:41 +0200 Subject: [PATCH 4/4] add changelog --- .github/workflows/build.yml | 3 --- CHANGELOG.md | 6 ++++++ 2 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 CHANGELOG.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7d5704b..b5ecfc9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -201,9 +201,6 @@ jobs: env: DOCKER_BUILDKIT: 0 - - name: Sleep - run: sleep 10 - - name: Run image env: DOCKER_BUILDKIT: 0 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..7f6d003 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,6 @@ +# Changelog + +## 2024-08-02 + +Deprecated the installation and update scripts that were previously included in the repository. +They will be removed November 2024, [use the Deployment Helper](https://developer.shopware.com/docs/guides/hosting/installation-updates/deployments/deployment-helper.html) as a replacement.