php-Dockerfile: rewrite header comment to avoid literal $ in prose

The previous fix (47a60b7) escaped the functional \$PHPIZE_DEPS
reference but added an explanatory comment that itself used several
bare/example $ characters (${PHPIZE_DEPS}, $PHPIZE_DEPS, $IDENTIFIER,
${IDENTIFIER}, and a bare $ before a comma). SimpleTemplateEngine
parses the ENTIRE file as template source, comments included, so any
of those threw either MissingPropertyException or a harder
'illegal string body character after dollar sign' parse error
depending on what followed the $.

Rewrote the comment to explain the rule in prose without using the $
glyph as an illustrative example at all, so future edits to the
comment can't reintroduce this. Verified via grep across all five
fallback Dockerfiles that the only remaining $ occurrences are the
intentional ${version} placeholders plus the one properly-escaped
\$PHPIZE_DEPS.
This commit is contained in:
Mukul Sharma
2026-09-03 15:10:50 +05:30
parent 47a60b7d95
commit f448f204e2
+19 -8
View File
@@ -17,14 +17,25 @@
# extensions on Alpine (unlike the Debian image, which had them
# preinstalled) — installed as a virtual package and removed again
# 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.
#
# NOTE ON DOLLAR SIGNS IN THIS FILE (read before editing anything
# below, comments included): the whole file — every line, comments
# included — is fed through constructTemplate.groovy's
# SimpleTemplateEngine before it becomes a real Dockerfile. That
# engine treats any dollar-sign character as the start of a Groovy
# interpolation, whether or not a human reading it would call it
# "code". A dollar sign followed by a letter or underscore gets
# looked up in the render binding (only `version` exists there) and
# throws a MissingPropertyException if not found there; a dollar sign
# followed by anything else (punctuation, space, end of line) can't
# even be parsed as an interpolation attempt and throws a harder
# syntax error instead. The only dollar sign meant to reach the shell
# below (in the PHPIZE_DEPS line) is escaped with a leading backslash
# for exactly this reason. Because a stray dollar sign in prose is
# this easy to reintroduce by accident (an earlier revision of this
# very comment did so), new edits to this header should avoid typing
# the character at all — write "dollar sign" in words instead of using
# the glyph.
FROM harbor.192.168.1.7.nip.io/base-images/php:${version}-cli-alpine
WORKDIR /var/www/html
RUN apk add --no-cache --virtual .build-deps \$PHPIZE_DEPS \