64 lines
3.0 KiB
Docker
64 lines
3.0 KiB
Docker
# CluPilot — app runtime image (dev + prod base).
|
|
# One image runs php-fpm + nginx + vite (via supervisor) for the `app` service,
|
|
# and is reused with an overridden command for `reverb` and `queue`.
|
|
FROM php:8.3-fpm-bookworm
|
|
|
|
ARG HOST_UID=1000
|
|
ARG HOST_GID=1000
|
|
|
|
# --- system packages -------------------------------------------------------
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
nginx supervisor git unzip curl ca-certificates gnupg \
|
|
libpng-dev libjpeg62-turbo-dev libfreetype6-dev \
|
|
libzip-dev libonig-dev libicu-dev \
|
|
wireguard-tools iproute2 openssh-client \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# --- php extensions --------------------------------------------------------
|
|
RUN docker-php-ext-configure gd --with-freetype --with-jpeg \
|
|
&& docker-php-ext-install -j"$(nproc)" \
|
|
pdo_mysql mbstring exif pcntl bcmath gd zip intl \
|
|
&& pecl install redis \
|
|
&& docker-php-ext-enable redis
|
|
|
|
# --- node 22 (for vite) ----------------------------------------------------
|
|
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
|
&& apt-get install -y --no-install-recommends nodejs \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# --- composer --------------------------------------------------------------
|
|
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
|
|
|
# --- match host uid/gid so bind-mounted files stay writable ---------------
|
|
#
|
|
# `usermod -o -u` vergibt eine neue Nummer — es schreibt aber KEINE einzige
|
|
# vorhandene Datei um. /var/www ist das Heimatverzeichnis von www-data und
|
|
# gehört danach weiterhin der Nummer 33 aus dem Basis-Abbild, während www-data
|
|
# 1000 (oder was HOST_UID sagt) ist. Das Heimatverzeichnis des Benutzers ist
|
|
# für ihn selbst also nicht beschreibbar.
|
|
#
|
|
# Aufgefallen an einem Deployment, das mit Code 243 abbrach: npm legt seinen
|
|
# Zwischenspeicher unter ~/.npm an, durfte das nicht, und meldete EACCES —
|
|
# errno -13, und 256 minus 13 ist 243. Der Server blieb im Wartungsmodus
|
|
# stehen. Composer hat dasselbe Problem und verzeiht es stillschweigend, was
|
|
# erklärt, warum es jahrelang niemandem auffiel: es trifft nur den, der hart
|
|
# scheitert, und nur wenn sich package.json überhaupt einmal ändert.
|
|
RUN groupmod -o -g "${HOST_GID}" www-data \
|
|
&& usermod -o -u "${HOST_UID}" -g "${HOST_GID}" www-data \
|
|
&& mkdir -p /var/www/.npm /var/www/.composer \
|
|
&& chown -R www-data:www-data /var/www
|
|
|
|
# --- config ----------------------------------------------------------------
|
|
COPY docker/php/php.ini /usr/local/etc/php/conf.d/zz-clupilot.ini
|
|
COPY docker/nginx/default.conf /etc/nginx/sites-enabled/default
|
|
COPY docker/supervisor/clupilot.conf /etc/supervisor/conf.d/clupilot.conf
|
|
COPY docker/entrypoint.sh /usr/local/bin/clupilot-entrypoint
|
|
RUN chmod +x /usr/local/bin/clupilot-entrypoint
|
|
|
|
WORKDIR /var/www/html
|
|
EXPOSE 80 5173 8080
|
|
|
|
# Entrypoint bootstraps vendor/node_modules on a fresh checkout (see script).
|
|
ENTRYPOINT ["clupilot-entrypoint"]
|
|
CMD ["supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]
|