Skip to content
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e95755a
Added arch tag
bluvulture Mar 27, 2025
48d0fa2
Added amend manifest step
bluvulture Mar 27, 2025
729b1a1
Added amend manifest step
bluvulture Mar 27, 2025
e6026c8
Added amend manifest step
bluvulture Mar 27, 2025
a89edbf
Added amend manifest step
bluvulture Mar 27, 2025
e5b90f2
Added amend manifest step
bluvulture Mar 27, 2025
40263ac
Added amend manifest step
bluvulture Mar 27, 2025
44d3618
Added amend manifest
bluvulture Mar 27, 2025
dbf7908
Native build
bluvulture Mar 27, 2025
ce82e96
Native build
bluvulture Mar 27, 2025
4a5fbe7
Native build
bluvulture Mar 27, 2025
f231106
Native build
bluvulture Mar 27, 2025
08b093c
Native build
bluvulture Mar 27, 2025
77b4007
Native build
bluvulture Mar 27, 2025
bf1eeef
Native build
bluvulture Mar 27, 2025
964ebb9
fixed clean tags
brusch Mar 27, 2025
8c8961a
push
brusch Mar 27, 2025
df1a29c
fix if statement
brusch Mar 27, 2025
c4902d8
Native build
bluvulture Mar 28, 2025
9648276
Native build
bluvulture Mar 28, 2025
ed1c7a0
Native build
bluvulture Mar 28, 2025
8f4fd6a
Native build
bluvulture Mar 28, 2025
b1f7b8c
Native build
bluvulture Mar 28, 2025
5b3d9e9
Native build
bluvulture Mar 28, 2025
cd4496a
Native build
bluvulture Mar 28, 2025
f3fe62d
Native build
bluvulture Mar 28, 2025
ea83169
Native build
bluvulture Mar 28, 2025
7145bbf
Native build
bluvulture Mar 28, 2025
e683845
Native build
bluvulture Mar 28, 2025
bdb92e0
Native build
bluvulture Mar 28, 2025
40ce727
Native build
bluvulture Mar 28, 2025
67c4e98
Native build
bluvulture Mar 28, 2025
750a093
Native build
bluvulture Mar 28, 2025
b4a969c
Merge branch '4.x' into native_build
bluvulture Mar 31, 2025
173b527
Native build
bluvulture Apr 1, 2025
c04fa05
Native build
bluvulture Apr 1, 2025
7c343d8
Clean up native build
bluvulture Apr 3, 2025
32068e9
Added second matrix tag for testing
bluvulture Apr 3, 2025
debaee1
Enabled all images
bluvulture Apr 3, 2025
d91ea3e
Lates and major fix
bluvulture Apr 3, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 87 additions & 42 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,103 +14,148 @@ env:
jobs:
build-php:
name: "Build PHP images"
runs-on: ubuntu-22.04
runs-on: ${{ matrix.runner }}
if: github.repository == 'pimcore/docker'
strategy:
matrix:
include:
runner:
- ubuntu-22.04
- ubuntu-22.04-arm
build:
- { tag: '1.x', php: '8.1', distro: bullseye, version-override: "v1-dev", latest-tag: false }
- { tag: '1.x', php: '8.2', distro: bullseye, version-override: "v1-dev", latest-tag: false }
- { tag: 'v1.3', php: '8.1', distro: bullseye, version-override: "", latest-tag: true }
- { tag: 'v1.3', php: '8.2', distro: bullseye, version-override: "", latest-tag: false }
- { tag: 'v2.0', php: '8.2', distro: bullseye, version-override: "", latest-tag: false }
- { tag: '2.x', php: '8.2', distro: bullseye, version-override: "v2-dev", latest-tag: false }
- { tag: 'v3.5', php: '8.2', distro: bookworm, version-override: "", latest-tag: true }
- { tag: 'v3.5', php: '8.3', distro: bookworm, imagick_version_from_src: 28f27044e435a2b203e32675e942eb8de620ee58, version-override: "", latest-tag: true }
- { tag: 'v3.5', php: '8.3', distro: bookworm, imagick_version_from_src: refs/tags/3.8.0RC2, version-override: "", latest-tag: true }
- { tag: '3.x', php: '8.2', distro: bookworm, version-override: "v3-dev", latest-tag: false }
- { tag: '3.x', php: '8.3', distro: bookworm, imagick_version_from_src: 28f27044e435a2b203e32675e942eb8de620ee58, version-override: "v3-dev", latest-tag: false }
- { tag: '4.x', php: '8.3', distro: bookworm, imagick_version_from_src: 28f27044e435a2b203e32675e942eb8de620ee58, version-override: "v4-dev", latest-tag: false }
- { tag: '4.x', php: '8.4', distro: bookworm, imagick_version_from_src: 28f27044e435a2b203e32675e942eb8de620ee58, version-override: "v4-dev", latest-tag: false }
- { tag: '3.x', php: '8.3', distro: bookworm, imagick_version_from_src: refs/tags/3.8.0RC2, version-override: "v3-dev", latest-tag: false }
- { tag: '4.x', php: '8.3', distro: bookworm, imagick_version_from_src: refs/tags/3.8.0RC2, version-override: "v4-dev", latest-tag: false }
- { tag: '4.x', php: '8.4', distro: bookworm, imagick_version_from_src: refs/tags/3.8.0RC2, version-override: "v4-dev", latest-tag: false }

steps:
- uses: actions/checkout@v4
with:
ref: ${{ matrix.tag }}
ref: ${{ matrix.build.tag }}

- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin

- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.tag }}
restore-keys: |
${{ runner.os }}-buildx-${{ matrix.php }}-${{ matrix.distro }}-${{ matrix.tag }}-

- name: Set up buildx
run: |
docker buildx create --name builder --platform linux/amd64,linux/arm64 --driver docker-container
docker buildx use builder
docker buildx inspect --bootstrap
- name: Configure and build images
id: vars
env:
VERSION_OVERRIDE: "${{ matrix.version-override }}"
VERSION_OVERRIDE: "${{ matrix.build.version-override }}"
ARCH_TAG: ${{ contains(matrix.runner, 'arm') && 'arm64' || 'amd64' }}
run: |
set -eux;
sudo apt-get update
if [[ "${{ matrix.tag }}" =~ ^v?1.[0-9x]+$ ]]; then

echo ${{ matrix.runner}}

if [[ "${{ matrix.build.tag }}" =~ ^v?1.[0-9x]+$ ]]; then
imageVariants=("fpm" "debug" "supervisord")
else
imageVariants=("min" "default" "max" "debug" "supervisord")
fi
for imageVariant in ${imageVariants[@]}; do
echo "Building image variant $imageVariant"
DOCKER_PLATFORMS=linux/amd64,linux/arm64
PHP_VERSION=${{ matrix.php }}
DEBIAN_VERSION="${{ matrix.distro }}"
VERSION="${{ matrix.tag }}"
PHP_VERSION=${{ matrix.build.php }}
DEBIAN_VERSION="${{ matrix.build.distro }}"
VERSION="${{ matrix.build.tag }}"
# for the latest dev branch we use "dev" as the version and not the name of the branch
if [ ! -z "$VERSION_OVERRIDE" ]; then
VERSION="$VERSION_OVERRIDE"
fi
PHP_SUB_VERSION=$(docker run -i --rm php:${{ matrix.php }}-fpm-${{ matrix.distro }} php -r 'echo PHP_VERSION;')
PHP_SUB_VERSION=$(docker run -i --rm php:${{ matrix.build.php }}-fpm-${{ matrix.build.distro }} php -r 'echo PHP_VERSION;')
if [ "$imageVariant" = "fpm" ] || [ "$imageVariant" = "default" ]; then
BASE_TAG="php${{ matrix.php }}"
BASE_TAG="php${{ matrix.build.php }}"
BASE_TAG_DETAILED="php${PHP_SUB_VERSION}"
else
BASE_TAG="php${{ matrix.php }}-$imageVariant"
BASE_TAG="php${{ matrix.build.php }}-$imageVariant"
BASE_TAG_DETAILED="php${PHP_SUB_VERSION}-$imageVariant"
fi
# DEBUG / TEST
#BASE_TAG="testv3-$BASE_TAG"
#BASE_TAG_DETAILED="testv3-$BASE_TAG_DETAILED"
TAG="${BASE_TAG}-${VERSION}"
TAG_DETAILED="${BASE_TAG_DETAILED}-${VERSION}"


TAG="${BASE_TAG}-${VERSION}-${ARCH_TAG}"
TAG_DETAILED="${BASE_TAG_DETAILED}-${VERSION}-${ARCH_TAG}"
TAGS="--tag ${IMAGE_NAME}:${TAG}"
TAGS="$TAGS --tag ${IMAGE_NAME}:${TAG_DETAILED}"
# Tag latest with Version build too
if [ "true" = "${{ matrix.latest-tag }}" ]; then
TAGS="$TAGS --tag ${IMAGE_NAME}:${BASE_TAG}-latest"
if [ "true" = "${{ matrix.build.latest-tag }}" ]; then
TAGS="$TAGS --tag ${IMAGE_NAME}:${BASE_TAG}-latest-${ARCH_TAG}"
fi
# Create tag for major version
if [[ $VERSION =~ ^v[0-9]+.[0-9]+$ ]]; then
VERSION_MAJOR=${VERSION//.[0-9]/}
TAGS="$TAGS --tag ${IMAGE_NAME}:${BASE_TAG}-${VERSION_MAJOR}"
TAGS="$TAGS --tag ${IMAGE_NAME}:${BASE_TAG}-${VERSION_MAJOR}-${ARCH_TAG}"
fi
echo ${TAGS}
docker buildx build --builder builder --output "type=image,push=true" --platform ${DOCKER_PLATFORMS} \

docker build --output "type=image,push=true" \
--target="pimcore_php_$imageVariant" \
--build-arg PHP_VERSION="${PHP_VERSION}" \
--build-arg DEBIAN_VERSION="${DEBIAN_VERSION}" \
--build-arg IMAGICK_VERSION_FROM_SRC="${{ matrix.imagick_version_from_src }}" \
--cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache-new" \
--build-arg IMAGICK_VERSION_FROM_SRC="${{ matrix.build.imagick_version_from_src }}" \
${TAGS} .
docker buildx imagetools inspect ${IMAGE_NAME}:${TAG} || true;

docker inspect ${IMAGE_NAME}:${TAG} || true;

CLEAN_TAGS="${TAGS//-arm64/}"
CLEAN_TAGS="${CLEAN_TAGS//-amd64/}"
CLEAN_TAGS="${CLEAN_TAGS//--tag /}"

read -r -a TAGS_ARRAY <<< "$CLEAN_TAGS"

for tag in "${TAGS_ARRAY[@]}"; do
echo "Processing tag: $tag"
echo "$tag" >> aggregated_tags.txt
done

done
- name: Move cache

- name: Upload aggregated tags
uses: actions/upload-artifact@v4
with:
name: aggregated_tags_${{ matrix.runner }}_${{ matrix.build.tag }}_${{ matrix.build.php }}_${{ matrix.build.distro }}_${{ matrix.build.version-override }}_${{ matrix.build.latest-tag }}
path: aggregated_tags.txt

process-tags:
runs-on: ubuntu-latest
needs: build-php
steps:

- name: Login to DockerHub Registry
run: echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin

- name: Download aggregated tags
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Process tags
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
find artifacts -type f -name "aggregated_tags.txt" -exec cat {} + > all_aggregated_tags.txt

readarray -t TAGS_ARRAY < all_aggregated_tags.txt

declare -A UNIQUE_TAGS
for tag in "${TAGS_ARRAY[@]}"; do
UNIQUE_TAGS["$tag"]=1
done

for tag in "${!UNIQUE_TAGS[@]}"; do
echo "Processing tag: $tag"

docker manifest create $tag \
--amend $tag-amd64 \
--amend $tag-arm64

docker manifest push $tag

done