93 lines
3.6 KiB
YAML
93 lines
3.6 KiB
YAML
---
|
|
# Development environment override
|
|
services:
|
|
php:
|
|
image: ${IMAGES_PREFIX:-}app-php-dev
|
|
build:
|
|
context: .
|
|
target: frankenphp_dev
|
|
volumes:
|
|
- ./:/app
|
|
- ./frankenphp/Caddyfile:/etc/frankenphp/Caddyfile:ro
|
|
- ./frankenphp/conf.d/20-app.dev.ini:/usr/local/etc/php/app.conf.d/20-app.dev.ini:ro
|
|
# Keep var/ off the bind-mount for faster I/O on Mac/Windows; comment to inspect from the host.
|
|
- /app/var
|
|
# If you develop on Mac or Windows you can remove the vendor/ directory
|
|
# from the bind-mount for better performance by enabling the next line:
|
|
#- /app/vendor
|
|
ports:
|
|
# HTTP-only in dev — no 443 mapping (SERVER_NAME ":80" means nothing listens there).
|
|
- "${HTTP_PORT:-8100}:80"
|
|
environment:
|
|
# HTTP-only in dev (no TLS, no HTTP→HTTPS redirect). App served on http://localhost:8100.
|
|
SERVER_NAME: ":80"
|
|
FRANKENPHP_WORKER_CONFIG: watch
|
|
FRANKENPHP_SITE_CONFIG: hot_reload
|
|
MERCURE_EXTRA_DIRECTIVES: demo
|
|
# See https://xdebug.org/docs/all_settings#mode
|
|
XDEBUG_MODE: "${XDEBUG_MODE:-develop}"
|
|
APP_ENV: "${APP_ENV:-dev}"
|
|
extra_hosts:
|
|
# Ensure that host.docker.internal is correctly defined on Linux
|
|
- host.docker.internal:host-gateway
|
|
tty: true
|
|
|
|
# Standalone React/Vite SPA (dev only — not in compose.prod.yaml; see #33/#35).
|
|
frontend:
|
|
image: node:22-alpine
|
|
working_dir: /app
|
|
volumes:
|
|
- ./frontend:/app
|
|
# Named volume shadows the bind-mounted node_modules so native deps
|
|
# (esbuild/rollup) are built for the container's arch, not the host's.
|
|
- frontend_node_modules:/app/node_modules
|
|
ports:
|
|
- "${VITE_PORT:-5173}:5173"
|
|
# Pin npm to the version in package.json's `packageManager` field (the
|
|
# image's bundled npm is older; corepack doesn't reliably repoint npm).
|
|
command: sh -c "npm install -g npm@11.17.0 && npm install && npm run dev -- --host 0.0.0.0 --port 5173"
|
|
depends_on:
|
|
- php
|
|
environment:
|
|
# Reliable file-watching under the bind-mount.
|
|
CHOKIDAR_USEPOLLING: "true"
|
|
# Marks the service healthy only once Vite is actually serving — the e2e
|
|
# runner waits on this (condition: service_healthy) to avoid racing startup.
|
|
# start_period covers the slow first boot (global npm install + npm install).
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://localhost:5173/"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 5
|
|
start_period: 90s
|
|
tty: true
|
|
|
|
# Playwright e2e runner (browsers + libs preinstalled). On-demand only — opt
|
|
# in with `--profile e2e`, so it never starts with a plain `dev-up`. Reaches
|
|
# the SPA by service name on the compose network (frontend:5173), so no host
|
|
# browsers are needed (NixOS host can't run Chromium natively). Image tag is
|
|
# pinned to the @playwright/test version in e2e/package.json — keep in sync.
|
|
playwright:
|
|
image: mcr.microsoft.com/playwright:v1.49.0-jammy
|
|
profiles: [e2e]
|
|
working_dir: /e2e
|
|
volumes:
|
|
- ./e2e:/e2e
|
|
- e2e_node_modules:/e2e/node_modules
|
|
environment:
|
|
# Target the SPA by compose service name, not localhost.
|
|
E2E_BASE_URL: "http://frontend:5173"
|
|
depends_on:
|
|
# Wait until Vite is actually serving, not just the container started.
|
|
frontend:
|
|
condition: service_healthy
|
|
# Pin npm to match package.json's `packageManager`; the image already has
|
|
# the browsers. Then install deps + run the suite.
|
|
command: sh -c "npm install -g npm@11.17.0 && npm install && npm test"
|
|
|
|
###> symfony/mercure-bundle ###
|
|
###< symfony/mercure-bundle ###
|
|
|
|
volumes:
|
|
frontend_node_modules:
|
|
e2e_node_modules:
|