|
@@ -28,8 +28,22 @@ RUN mkdir -p /build/vendor \
|
|
|
&& cp node_modules/htmx.org/dist/htmx.min.js /build/vendor/htmx.min.js \
|
|
&& cp node_modules/htmx.org/dist/htmx.min.js /build/vendor/htmx.min.js \
|
|
|
&& cp node_modules/sortablejs/Sortable.min.js /build/vendor/sortable.min.js
|
|
&& cp node_modules/sortablejs/Sortable.min.js /build/vendor/sortable.min.js
|
|
|
|
|
|
|
|
-# --- Stage 2: the actual PHP runtime ------------------------------------
|
|
|
|
|
-FROM php:8.3-apache
|
|
|
|
|
|
|
+# --- Stage 2: tailwind --watch (dev only) -------------------------------
|
|
|
|
|
+# Used by docker-compose.dev.yml. Source dirs are bind-mounted from the
|
|
|
|
|
+# host at /build/* and `app.css` is regenerated on save. Vendor JS bundles
|
|
|
|
|
+# are seeded into the host-mounted public/assets/js/vendor on first start
|
|
|
|
|
+# by bin/dev-css-watcher.sh — they don't change between iterations so a
|
|
|
|
|
+# single seed at startup is enough.
|
|
|
|
|
+FROM node:20-alpine AS css-watcher
|
|
|
|
|
+WORKDIR /build
|
|
|
|
|
+COPY package.json package-lock.json* ./
|
|
|
|
|
+RUN npm ci --no-audit --no-fund
|
|
|
|
|
+COPY bin/dev-css-watcher.sh /usr/local/bin/dev-css-watcher.sh
|
|
|
|
|
+RUN chmod +x /usr/local/bin/dev-css-watcher.sh
|
|
|
|
|
+CMD ["/usr/local/bin/dev-css-watcher.sh"]
|
|
|
|
|
+
|
|
|
|
|
+# --- Stage 3: the actual PHP runtime ------------------------------------
|
|
|
|
|
+FROM php:8.3-apache AS runtime
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
libsqlite3-dev libzip-dev libpng-dev libjpeg-dev libfreetype6-dev unzip git \
|
|
libsqlite3-dev libzip-dev libpng-dev libjpeg-dev libfreetype6-dev unzip git \
|
|
@@ -79,3 +93,13 @@ RUN install -m 0755 /var/www/html/bin/docker-entrypoint.sh /usr/local/bin/docker
|
|
|
EXPOSE 80
|
|
EXPOSE 80
|
|
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
|
|
CMD ["apache2-foreground"]
|
|
CMD ["apache2-foreground"]
|
|
|
|
|
+
|
|
|
|
|
+# --- Stage 4: phpunit + dev composer deps (test runner) -----------------
|
|
|
|
|
+# Built on top of `runtime` so the test environment matches prod exactly,
|
|
|
|
|
+# then layers in the composer dev dependencies (phpunit, mocks). Used by
|
|
|
|
|
+# `make test` / `make check` via `docker compose run --rm tests`.
|
|
|
|
|
+# Inherits the entrypoint, which runs migrations against an in-container
|
|
|
|
|
+# SQLite before phpunit starts — tests get a fresh, fully-migrated schema.
|
|
|
|
|
+FROM runtime AS tests
|
|
|
|
|
+RUN composer install --no-interaction --prefer-dist --no-progress
|
|
|
|
|
+CMD ["composer", "test"]
|