Every language's Dockerfile fallback template now pulls from harbor.192.168.1.7.nip.io/base-images/... (mirrored from Docker Hub via the new devops-base-images repo) instead of pulling live from Docker Hub on every build. Eliminates that external dependency at build time, and lets the mirrored tags be deliberately the leanest official variant rather than whatever a public tag happens to default to. - go: unchanged tags (golang:1.22-alpine, alpine:3.20 — already minimal), just re-hosted. - node/python/java: moved from their Debian-slim defaults to the -alpine equivalent (node:20-alpine, python:3.12-alpine, maven:3-eclipse-temurin-21-alpine, eclipse-temurin:21-jre-alpine). - php: bigger change — dropped php:*-apache (Debian, full Apache httpd) entirely for php:*-cli-alpine + PHP's own built-in dev server (`php -S`), moving to port 8080 like every other language instead of PHP's special-cased 80. Not production-grade PHP serving (PHP's own docs call the built-in server not designed for that), but genuinely minimal and fine for a homelab/demo app — would need php-fpm+nginx for anything serving real traffic. Only versions actually mirrored into Harbor resolve now — a dockerBuildVersion whose tag isn't in devops-base-images/images.txt needs that added and re-mirrored first, unlike pulling straight from Docker Hub where any tag "just worked". Chose keeping a shell (Alpine) over full distroless — homelab kubectl-exec debuggability weighed more than the last bit of attack-surface reduction.
34 lines
1.7 KiB
Plaintext
34 lines
1.7 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.
|
|
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 \
|
|
&& 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", "."]
|