A docker-compose.yml
template that I use for development
version: "3" services: api: build: context: ./api dockerfile: Dockerfile.dev container_name: ${APP_NAME}-api ports: - 8402:443 environment: APP_BASE_URL: https://${APP_HOST}:8402 APP_ENV: development DB_NAME: DB_USER: DB_PASS: DB_HOST: db SESSION_COOKIE_DOMAIN: SESSION_NAME: SESSION_EXPIRY: #dev only PHP_IDE_CONFIG: serverName=${APP_HOST} XDEBUG_CONFIG: "remote_host=host.docker.internal idekey=${APP_HOST}" XDEBUG_IDEKEY: ${APP_HOST} volumes: - ./api:/var/www/ db: image: mysql:8.0.13 container_name: ${APP_NAME}-db ports: - 8404:3306 volumes: - ${APP_NAME}-db-data:/var/lib/mysql - ./db/dump.sql:/docker-entrypoint-initdb.d/dump.sql - ./mysql/my.cnf:/etc/mysql/conf.d/my.cnf environment: MYSQL_ROOT_PASSWORD: MYSQL_DATABASE: MYSQL_USER: MYSQL_PASSWORD: volumes: db-data: name: ${APP_NAME}-db-data
A .env
file is also required.
# for dev environment only APP_HOST=project-name.local.example.dev APP_NAME=project-name