Files
devops-lib-gcp/resources/com/homelab/php-Dockerfile
T
Mukul SharmaandClaude Opus 5 3e09eecbfe GKE: point the pipeline at this cluster's registry, over TLS
The GCP counterpart of devops-lib. Registered in Jenkins under the same
name, so consuming repos need no change: the two-line Jenkinsfile is
identical on both clusters, and which library it resolves to is a property
of the Jenkins running it.

Substantive changes, all consequences of GKE being a real cloud:

- Harbor speaks TLS here, so dind no longer passes --insecure-registry.
  It mounts the private CA at
  /etc/docker/certs.d/harbor.35.238.248.203.nip.io/ca.crt instead, from the
  registry-ca ConfigMap. This is not redundant with the node pool's trust:
  that covers pulls, performed by containerd on the node, while the push
  comes from dockerd in the build pod with its own trust store. Without it,
  pushes fail TLS verification while pulls of the same image succeed —
  which reads like a broken registry rather than a missing trust anchor.

- The registry hostname changes in the push target and all five fallback
  Dockerfiles. It still must be spelled identically everywhere, because
  Docker matches credentials and trust by exact hostname.

- helm_repo_url moves to cluster DNS. That clone runs in a build pod, so
  sending it out through the ingress and back would make the pipeline
  depend on Contour for pod-to-pod traffic. syncArgoApp already addressed
  ArgoCD this way and needed no change.

- build-tools.Dockerfile is removed: devops-base-images-gcp owns it now,
  next to the mirrored base images, and the pod references the result by
  tag at base-images/build-tools:1. The base-images project is public, so
  the pod can pull it before it has any credentials.

Verified: no homelab addresses remain; the pod template parses with the CA
mount, the new image and no insecure-registry flag; and every fallback
template's base image, with the default version buildDocker would pick, is
present in the mirror manifest — an unmirrored tag now fails the build
rather than silently falling back to Docker Hub.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LEsTefWWifp4ikvhHF5s6N
2026-09-13 01:27:05 +05:30

53 lines
2.8 KiB
Plaintext

# Fallback only — see go-Dockerfile's header comment for the general
# rule, including the Harbor base-images sourcing (also applies here).
# Simplified from the real php-Dockerfile. Assumes a standard
# composer-based repo.
#
# Was php:*-apache (Debian, full Apache httpd) — dropped Apache
# entirely in favor of php:*-cli-alpine + PHP's own built-in dev server
# (`php -S`). Genuinely minimal (no httpd, no extra process, Alpine
# base) and brings this language in line with every other one here on
# port 8080 instead of PHP's special-cased 80. Trade-off, stated
# plainly: PHP's own docs call the built-in server "not designed to be
# a full-featured web server" for production — perfectly fine for a
# homelab/demo app, would need revisiting (php-fpm + nginx, two
# processes/containers) for anything serving real production traffic.
#
# docker-php-ext-install needs PHPIZE_DEPS present to compile
# 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.
#
# 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.35.238.248.203.nip.io/base-images/php:${version}-cli-alpine
WORKDIR /var/www/html
RUN apk add --no-cache --virtual .build-deps \$PHPIZE_DEPS \
&& docker-php-ext-install pdo pdo_mysql \
&& apk del .build-deps
COPY . .
RUN if [ -f composer.json ]; then \
apk add --no-cache --virtual .composer-deps curl && \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
composer install --no-dev --optimize-autoloader && \
apk del .composer-deps; \
fi
EXPOSE 8080
CMD ["php", "-S", "0.0.0.0:8080", "-t", "."]