Skip to content

Commit b8ba854

Browse files
committed
Enhance Docker configuration to support multiple PHP versions and update PIE version
Signed-off-by: Moritz Mazetti <moritz@matchory.com>
1 parent e296c99 commit b8ba854

4 files changed

Lines changed: 23 additions & 6 deletions

File tree

.github/workflows/docker.yaml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on:
1313

1414
env:
1515
LATEST_VERSION: ${{ vars.LATEST_PHP_VERSION || '8.4' }}
16+
# PHP versions to build - keep in sync with build matrix
17+
PHP_VERSIONS: '8.4 8.5'
18+
# PIE version used in Dockerfiles - keep in sync with ARG PIE_VERSION
19+
PIE_VERSION: '1.3.1'
1620

1721
permissions:
1822
contents: read
@@ -31,7 +35,7 @@ jobs:
3135

3236
- name: Cache digests
3337
id: cache-digests
34-
uses: actions/cache@v4
38+
uses: actions/cache@v5
3539
with:
3640
path: latest-digests.txt
3741
key: digest-cache-${{ runner.os }}-${{ hashFiles('*Dockerfile') }}
@@ -50,7 +54,20 @@ jobs:
5054
while IFS= read -r image; do
5155
# only include real image names, ignoring internal stages
5256
if [[ "${image}" == *"/"* || "${image}" == *":"* ]]; then
53-
base_images+=("${image}")
57+
# Expand PIE_VERSION variable (constant across all Dockerfiles)
58+
image="${image//\$\{PIE_VERSION\}/${PIE_VERSION}}"
59+
image="${image//\$PIE_VERSION/${PIE_VERSION}}"
60+
61+
# Expand PHP_VERSION variable for each version in the matrix
62+
if [[ "${image}" == *'${PHP_VERSION}'* || "${image}" == *'$PHP_VERSION'* ]]; then
63+
for php_version in ${PHP_VERSIONS}; do
64+
expanded="${image//\$\{PHP_VERSION\}/${php_version}}"
65+
expanded="${expanded//\$PHP_VERSION/${php_version}}"
66+
base_images+=("${expanded}")
67+
done
68+
else
69+
base_images+=("${image}")
70+
fi
5471
fi
5572
done < <( \
5673
grep -e '^FROM ' "${file}" | \
@@ -135,7 +152,7 @@ jobs:
135152
136153
- name: Save digests cache
137154
if: ${{ fromJSON(steps.check.outputs.changed) }}
138-
uses: actions/cache@v4
155+
uses: actions/cache@v5
139156
with:
140157
path: latest-digests.txt
141158
key: digest-cache-${{ runner.os }}-${{ hashFiles('*Dockerfile') }}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22
ARG PHP_VERSION="8.4"
3-
ARG PIE_VERSION="1.3.0"
3+
ARG PIE_VERSION="1.3.1"
44
FROM ghcr.io/php/pie:${PIE_VERSION}-bin AS pie
55
FROM php:${PHP_VERSION}-cli AS upstream
66
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \

alpine.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22
ARG PHP_VERSION="8.4"
3-
ARG PIE_VERSION="1.3.0"
3+
ARG PIE_VERSION="1.3.1"
44
FROM ghcr.io/php/pie:${PIE_VERSION}-bin AS pie
55
FROM php:${PHP_VERSION}-cli-alpine AS upstream
66
FROM upstream AS base

frankenphp.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:1
22
ARG PHP_VERSION="8.4"
3-
ARG PIE_VERSION="1.3.0"
3+
ARG PIE_VERSION="1.3.1"
44
FROM ghcr.io/php/pie:${PIE_VERSION}-bin AS pie
55
FROM dunglas/frankenphp:1.10-php${PHP_VERSION} AS upstream
66
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \

0 commit comments

Comments
 (0)