71 lines
2.0 KiB
YAML
71 lines
2.0 KiB
YAML
services:
|
|
php:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
target: dev # change to "prod" for production build
|
|
args:
|
|
- APP_ENV=dev
|
|
container_name: app-php
|
|
restart: unless-stopped
|
|
environment:
|
|
DEFAULT_URI: ${DEFAULT_URI:-http://localhost:8080}
|
|
APP_ENV: ${APP_ENV:-dev}
|
|
APP_SECRET: ${APP_SECRET:-change_me}
|
|
DATABASE_URL: ${DATABASE_URL:-postgresql://${POSTGRES_USER:-symfony}:${POSTGRES_PASSWORD:-symfony}@db:5432/${POSTGRES_DB:-symfony}?serverVersion=16&charset=utf8}
|
|
volumes:
|
|
- ./bin:/var/www/html/bin
|
|
- ./config:/var/www/html/config
|
|
- ./public:/var/www/html/public
|
|
- ./src:/var/www/html/src
|
|
- ./var:/var/www/html/var
|
|
- ./vendor:/var/www/html/vendor
|
|
- ./composer.json:/var/www/html/composer.json
|
|
- ./composer.lock:/var/www/html/composer.lock
|
|
- ./symfony.lock:/var/www/html/symfony.lock # preferred
|
|
- composer-cache:/tmp/composer
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "php -v || exit 1"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 5
|
|
depends_on:
|
|
- db
|
|
|
|
nginx:
|
|
image: nginx:alpine
|
|
container_name: nginx
|
|
restart: unless-stopped
|
|
ports:
|
|
- "8080:80"
|
|
volumes:
|
|
- ./public:/var/www/html/public:ro
|
|
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
|
|
depends_on:
|
|
- php
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "wget -qO- http://localhost/healthz || exit 1"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 5
|
|
|
|
db:
|
|
image: postgres:16-alpine
|
|
container_name: postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DB:-symfony}
|
|
POSTGRES_USER: ${POSTGRES_USER:-symfony}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-symfony}
|
|
volumes:
|
|
- db-data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-symfony} -d ${POSTGRES_DB:-symfony}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
volumes:
|
|
db-data:
|
|
composer-cache:
|