services: app: build: context: . dockerfile: resources/docker/Dockerfile args: PHP_VERSION: ${PHP_VERSION:-8.4} PHALCON_VARIANT: ${PHALCON_VARIANT:-v5} UID: ${UID:-1000} GID: ${GID:-1000} container_name: ${PROJECT_PREFIX:-tutorial}-app hostname: ${PROJECT_PREFIX:-tutorial}-app ports: - "${APP_PORT:-8080}:8080" volumes: - .:/srv # Preserve the image's vendor/ (installed at build) from being shadowed by the bind mount - /srv/vendor env_file: .env depends_on: mysql: condition: service_healthy mysql: image: mysql:8.0 container_name: ${PROJECT_PREFIX:-tutorial}-mysql environment: MYSQL_ROOT_PASSWORD: ${DB_PASSWORD:-secret} MYSQL_DATABASE: ${DB_NAME:-tutorial} volumes: - ./resources/schemas/tutorial.sql:/docker-entrypoint-initdb.d/tutorial.sql:ro # No host port published: the app reaches the DB over the compose network as mysql:3306. healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-p${DB_PASSWORD:-secret}"] interval: 5s timeout: 5s retries: 12