Escape \$PHPIZE_DEPS in php-Dockerfile template

Build failed: groovy.lang.MissingPropertyException: No such property:
PHPIZE_DEPS. This whole file is rendered through
constructTemplate.groovy's SimpleTemplateEngine before it ever becomes
a real Dockerfile — bare $IDENTIFIER is Groovy GString interpolation
syntax, same as ${IDENTIFIER}, so it tried resolving PHPIZE_DEPS
against the render binding (which only has `version`) instead of
leaving it as literal shell syntax for docker-php-ext-install to
expand at RUN time. \$ is the correct escape for a literal dollar sign
in SimpleTemplateEngine output.
This commit is contained in:
Mukul Sharma
2026-09-03 14:58:30 +05:30
parent 63eef9014b
commit 47a60b7d95
+9 -1
View File
@@ -17,9 +17,17 @@
# extensions on Alpine (unlike the Debian image, which had them # extensions on Alpine (unlike the Debian image, which had them
# preinstalled) — installed as a virtual package and removed again # preinstalled) — installed as a virtual package and removed again
# right after, so the final image doesn't carry build tooling. # right after, so the final image doesn't carry build tooling.
# \$PHPIZE_DEPS escaped (not ${PHPIZE_DEPS} or bare $PHPIZE_DEPS) —
# this whole file goes through constructTemplate.groovy's
# SimpleTemplateEngine first, which treats bare $IDENTIFIER the same
# as ${IDENTIFIER} (Groovy GString interpolation syntax) and tried to
# resolve it against the render binding (which only has `version`),
# throwing MissingPropertyException before this ever became a real
# Dockerfile. \$ survives the template pass as a literal $, which is
# what the shell needs to actually expand this at RUN time.
FROM harbor.192.168.1.7.nip.io/base-images/php:${version}-cli-alpine FROM harbor.192.168.1.7.nip.io/base-images/php:${version}-cli-alpine
WORKDIR /var/www/html WORKDIR /var/www/html
RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \ RUN apk add --no-cache --virtual .build-deps \$PHPIZE_DEPS \
&& docker-php-ext-install pdo pdo_mysql \ && docker-php-ext-install pdo pdo_mysql \
&& apk del .build-deps && apk del .build-deps
COPY . . COPY . .