-
Notifications
You must be signed in to change notification settings - Fork 0
Docker
An app container (PHP-FPM), Nginx as a reverse proxy, and a database container (MySQL/MariaDB or PostgreSQL — choose one in docker-compose.yml). Apache is intentionally excluded; .htaccess already covers shared-hosting deployments.
docker compose up -d --build # uses docker-compose.override.yml automatically if present
docker compose logs -f app
docker compose down # stop
docker compose down -v # stop + wipe volumes (deletes the database)App reachable at http://localhost:8050 (adjust the port in the nginx service if needed).
The db container starts empty — create tables manually the first time, inside the container:
# MySQL/MariaDB
docker compose exec db mysql -u root -p"${DB_ROOT_PASSWORD:-changeme}" "${DB_NAME:-tanuki_db}"
# PostgreSQL
docker compose exec db psql -U "${DB_USER:-tanuki}" -d "${DB_NAME:-tanuki_db}"Then run your CREATE TABLE statements as usual. Alternative: mount a docker/init.sql at /docker-entrypoint-initdb.d/init.sql in the db service — it runs automatically the first time the data volume is empty.
DB_HOST=db # service name, not "localhost" — containers resolve each other by namedocker-compose.override.yml loads automatically alongside docker-compose.yml and adds PHPUnit + Xdebug (INSTALL_DEV_DEPS=true, APP_DEBUG=true). For production, exclude it:
docker compose -f docker-compose.yml up -d --builddocker compose exec app ./vendor/bin/phpunitUnlike local Xdebug, your editor runs on the host, not the container — Xdebug needs to reach out.
Already configured via docker-compose.override.yml:
environment:
- XDEBUG_MODE=debug
- XDEBUG_CONFIG=client_host=host.docker.internal client_port=9003
extra_hosts:
- "host.docker.internal:host-gateway"launch.json needs pathMappings here (unlike local dev) since the container's project path differs from your host's:
{
"configurations": [{
"name": "Listen for Xdebug",
"type": "php", "request": "launch", "port": 9003,
"pathMappings": { "/var/www/html": "${workspaceFolder}" }
}]
}Troubleshooting: docker compose exec app getent hosts host.docker.internal — if that fails, on old Docker Engine (Linux, no Docker Desktop) use the docker0 bridge IP (ip addr show docker0) as client_host instead.