# Convenience wrappers for the dev/prod compose split. Targets are split # along the same axis as the compose files: anything `dev-*` uses the # overlay, anything else hits prod. COMPOSE_PROD = docker compose COMPOSE_DEV = docker compose -f docker-compose.yml -f docker-compose.dev.yml # Exported so the css-watcher service can run as the host user via # `user: "${HOST_UID}:${HOST_GID}"` in docker-compose.dev.yml. Files the # watcher writes into bind-mounted host paths (public/assets/css/app.css, # public/assets/js/vendor/*) then land with normal ownership. export HOST_UID := $(shell id -u) export HOST_GID := $(shell id -g) .PHONY: help dev dev-build dev-down prod prod-build prod-down \ test lint check shell logs help: @echo "Dev:" @echo " make dev start dev stack (app + css-watcher) in foreground" @echo " make dev-build rebuild dev images" @echo " make dev-down stop and remove dev containers" @echo " make shell bash into the running app container" @echo " make logs tail logs from the dev stack" @echo "" @echo "Prod:" @echo " make prod start prod stack detached" @echo " make prod-build rebuild prod image" @echo " make prod-down stop and remove prod containers" @echo "" @echo "Checks (one-shot containers, no running stack required):" @echo " make lint php -l on src/ + tests/" @echo " make test phpunit" @echo " make check lint + test (used by /check skill)" # --- dev ---------------------------------------------------------------- dev: $(COMPOSE_DEV) up dev-build: $(COMPOSE_DEV) build dev-down: $(COMPOSE_DEV) down shell: $(COMPOSE_DEV) exec app bash logs: $(COMPOSE_DEV) logs -f # --- prod --------------------------------------------------------------- prod: $(COMPOSE_PROD) up -d prod-build: $(COMPOSE_PROD) build prod-down: $(COMPOSE_PROD) down # --- checks (one-shot, profile=test) ------------------------------------ # `run --rm` builds the tests image if needed, runs the command, and # tears the container down. Doesn't require `make dev` to be running. lint: $(COMPOSE_DEV) --profile test run --rm tests \ sh -c 'find src tests -name "*.php" -print0 | xargs -0 -n1 -P 4 php -l > /dev/null && echo "lint: OK"' test: $(COMPOSE_DEV) --profile test run --rm tests check: lint test