Skip to content

Commit a82557b

Browse files
committed
Update Dockerfiles to use 'pie' version 1.3.0-rc.3 and install uv extension via PECL
Signed-off-by: Moritz Mazetti <moritz@matchory.com>
1 parent f97456a commit a82557b

3 files changed

Lines changed: 37 additions & 55 deletions

File tree

Dockerfile

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# syntax=docker/dockerfile:1
22
ARG PHP_VERSION="8.4"
3+
ARG PIE_VERSION="1.3.0-rc.3"
4+
FROM ghcr.io/php/pie:${PIE_VERSION} AS pie
35
FROM php:${PHP_VERSION}-cli AS upstream
46
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
57
--mount=type=cache,target=/var/lib/apt,sharing=locked <<EOF
@@ -25,10 +27,9 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
2527
EOF
2628

2729
FROM upstream AS builder
28-
ARG PIE_VERSION="1.3.0-rc.2"
2930
ARG UV_VERSION="0.3.0"
3031

31-
RUN --mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/bin/pie \
32+
RUN --mount=type=bind,from=pie,source=/pie,target=/usr/bin/pie \
3233
--mount=type=cache,target=/var/cache/apt,sharing=locked \
3334
--mount=type=cache,target=/var/lib/apt,sharing=locked <<EOF
3435
set -eux
@@ -75,19 +76,6 @@ RUN --mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/bin/pie \
7576
#;
7677
# endregion
7778

78-
# region Install uv extension
79-
curl \
80-
--output /tmp/uv.tar.gz \
81-
--location \
82-
--silent \
83-
--fail \
84-
"https://github.com/amphp/ext-uv/archive/v${UV_VERSION}.tar.gz"
85-
tar xfz /tmp/uv.tar.gz
86-
rm -r /tmp/uv.tar.gz
87-
mkdir -p /usr/src/php/ext
88-
mv ext-uv-${UV_VERSION} /usr/src/php/ext/uv
89-
# endregion
90-
9179
# region Install built-in extensions
9280
docker-php-ext-configure zip
9381
docker-php-ext-install -j$(nproc) \
@@ -98,7 +86,6 @@ RUN --mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/bin/pie \
9886
pcntl \
9987
intl \
10088
zip \
101-
uv \
10289
;
10390

10491
# If we're running on PHP 8.4, install the opcache extension (it's bundled in later versions)
@@ -107,11 +94,18 @@ RUN --mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/bin/pie \
10794
fi
10895
# endregion
10996

97+
# region Install uv extension
98+
pecl config-set preferred_state beta
99+
pecl install "uv-${UV_VERSION}"
100+
pecl config-set preferred_state stable
101+
# endregion
102+
110103
# region Install PECL extensions
111104
pecl install excimer
112105
pecl clear-cache || true
113106
docker-php-ext-enable \
114107
excimer \
108+
uv \
115109
;
116110
# endregion
117111

@@ -197,7 +191,7 @@ ENV PHP_IDE_CONFIG="serverName=Docker"
197191

198192
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
199193
--mount=type=cache,target=/var/lib/apt,sharing=locked \
200-
--mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/bin/pie \
194+
--mount=type=bind,from=pie,source=/pie,target=/usr/bin/pie \
201195
--mount=type=bind,from=upstream,source=/usr/local/bin,target=/usr/local/bin \
202196
<<EOF
203197
set -eux
@@ -206,7 +200,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
206200
# region Install XDebug
207201
# TODO: Switch to stable when available
208202
if php --version | grep -q "PHP 8\.5"; then
209-
pie install xdebug/xdebug:^3@alpha
203+
pie install xdebug/xdebug:@alpha
210204
else
211205
pie install xdebug/xdebug
212206
fi

alpine.Dockerfile

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# syntax=docker/dockerfile:1
22
ARG PHP_VERSION="8.4"
3+
ARG PIE_VERSION="1.3.0-rc.3"
4+
FROM ghcr.io/php/pie:${PIE_VERSION} AS pie
35
FROM php:${PHP_VERSION}-cli-alpine AS upstream
46
FROM upstream AS base
5-
ARG PIE_VERSION="1.3.0-rc.2"
67
ARG UV_VERSION="0.3.0"
78
ARG user="php"
89
ARG uid="5000"
@@ -11,8 +12,8 @@ ARG uid="5000"
1112
# see https://github.com/docker-library/php/issues/240#issuecomment-763112749
1213
ENV LD_PRELOAD="/usr/lib/preloadable_libiconv.so"
1314

14-
COPY --link --from=ghcr.io/php/pie:bin /pie /usr/bin/pie
15-
RUN <<EOF
15+
RUN --mount=type=bind,from=pie,source=/pie,target=/usr/bin/pie \
16+
<<EOF
1617
set -eux
1718

1819
# region Install Dependencies
@@ -71,19 +72,6 @@ RUN <<EOF
7172
#;
7273
# endregion
7374

74-
# region Install uv extension
75-
curl \
76-
--fail \
77-
--silent \
78-
--location \
79-
--output /tmp/uv.tar.gz \
80-
"https://github.com/amphp/ext-uv/archive/v${UV_VERSION}.tar.gz"
81-
tar xfz /tmp/uv.tar.gz
82-
rm -r /tmp/uv.tar.gz
83-
mkdir -p /usr/src/php/ext
84-
mv ext-uv-${UV_VERSION} /usr/src/php/ext/uv
85-
# endregion
86-
8775
# region Install built-in extensions
8876
docker-php-ext-configure zip
8977
docker-php-ext-install -j$(nproc) \
@@ -94,7 +82,6 @@ RUN <<EOF
9482
pcntl \
9583
intl \
9684
zip \
97-
uv \
9885
;
9986

10087
# If we're running on PHP 8.4, install the opcache extension (it's bundled in later versions)
@@ -103,11 +90,18 @@ RUN <<EOF
10390
fi
10491
# endregion
10592

93+
# region Install uv extension
94+
pecl config-set preferred_state beta
95+
pecl install "uv-${UV_VERSION}"
96+
pecl config-set preferred_state stable
97+
# endregion
98+
10699
# region Install PECL extensions
107100
pecl install excimer
108101
pecl clear-cache || true
109102
docker-php-ext-enable \
110103
excimer \
104+
uv \
111105
;
112106
# endregion
113107

@@ -194,7 +188,7 @@ ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="1"
194188
# Enables PHPStorm to apply the correct path mapping on Xdebug breakpoints
195189
ENV PHP_IDE_CONFIG="serverName=Docker"
196190

197-
RUN --mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/bin/pie \
191+
RUN --mount=type=bind,from=pie,source=/pie,target=/usr/bin/pie \
198192
--mount=type=bind,from=upstream,source=/usr/local/bin,target=/usr/local/bin \
199193
<<EOF
200194
set -eux
@@ -210,7 +204,7 @@ RUN --mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/bin/pie \
210204

211205
# TODO: Switch to stable when available
212206
if php --version | grep -q "PHP 8\.5"; then
213-
pie install xdebug/xdebug:^3@alpha
207+
pie install xdebug/xdebug:@alpha
214208
else
215209
pie install xdebug/xdebug
216210
fi

frankenphp.Dockerfile

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# syntax=docker/dockerfile:1
22
ARG PHP_VERSION="8.4"
3+
ARG PIE_VERSION="1.3.0-rc.3"
4+
FROM ghcr.io/php/pie:${PIE_VERSION} AS pie
35
FROM dunglas/frankenphp:1.10-php${PHP_VERSION} AS upstream
46
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
57
--mount=type=cache,target=/var/lib/apt,sharing=locked <<EOF
@@ -25,12 +27,11 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
2527
EOF
2628

2729
FROM upstream AS builder
28-
ARG PIE_VERSION="1.3.0-rc.2"
2930
ARG UV_VERSION="0.3.0"
3031

3132
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
3233
--mount=type=cache,target=/var/lib/apt,sharing=locked \
33-
--mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/local/bin/pie \
34+
--mount=type=bind,from=pie,source=/pie,target=/usr/bin/pie \
3435
<<EOF
3536
set -eux
3637

@@ -75,19 +76,6 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
7576
#;
7677
# endregion
7778

78-
# region Install uv extension
79-
curl \
80-
--fail \
81-
--silent \
82-
--location \
83-
--output /tmp/uv.tar.gz \
84-
"https://github.com/amphp/ext-uv/archive/v${UV_VERSION}.tar.gz"
85-
tar xfz /tmp/uv.tar.gz
86-
rm -r /tmp/uv.tar.gz
87-
mkdir -p /usr/src/php/ext
88-
mv ext-uv-${UV_VERSION} /usr/src/php/ext/uv
89-
# endregion
90-
9179
# region Install built-in extensions
9280
docker-php-ext-configure zip
9381
docker-php-ext-install -j$(nproc) \
@@ -98,7 +86,6 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
9886
pcntl \
9987
intl \
10088
zip \
101-
uv \
10289
;
10390

10491
# If we're running on PHP 8.4, install the opcache extension (it's bundled in later versions)
@@ -108,11 +95,18 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
10895

10996
# endregion
11097

98+
# region Install uv extension
99+
pecl config-set preferred_state beta
100+
pecl install "uv-${UV_VERSION}"
101+
pecl config-set preferred_state stable
102+
# endregion
103+
111104
# region Install PECL extensions
112105
pecl install excimer
113106
pecl clear-cache || true
114107
docker-php-ext-enable \
115108
excimer \
109+
uv \
116110
;
117111
# endregion
118112
EOF
@@ -198,7 +192,7 @@ ENV PHP_IDE_CONFIG="serverName=Docker"
198192

199193
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
200194
--mount=type=cache,target=/var/lib/apt,sharing=locked \
201-
--mount=type=bind,from=ghcr.io/php/pie:bin,source=/pie,target=/usr/bin/pie \
195+
--mount=type=bind,from=pie,source=/pie,target=/usr/bin/pie \
202196
--mount=type=bind,from=upstream,source=/usr/local/bin,target=/usr/local/bin \
203197
<<EOF
204198
set -eux
@@ -207,7 +201,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
207201
# region Install XDebug
208202
# TODO: Switch to stable when available
209203
if php --version | grep -q "PHP 8\.5"; then
210-
pie install xdebug/xdebug:^3@alpha
204+
pie install xdebug/xdebug:@alpha
211205
else
212206
pie install xdebug/xdebug
213207
fi

0 commit comments

Comments
 (0)