refactor(docker-compose.yml): add healthcheck to ensure database service is healthy before starting the server feat(docker-compose.yml): add condition to wait for database service to be ready before starting the server
29 lines
604 B
YAML
29 lines
604 B
YAML
services:
|
|
diiis-na-server:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: diiis-na-server
|
|
depends_on:
|
|
- db:
|
|
condition: service_healthy
|
|
|
|
db:
|
|
image: postgres:17
|
|
container_name: diiis-na-db
|
|
environment:
|
|
- POSTGRES_USER=postgres
|
|
- POSTGRES_PASSWORD=postgres
|
|
- POSTGRES_DB=diablo
|
|
volumes:
|
|
- db-data:/var/lib/postgresql/data
|
|
- ./db/initdb:/docker-entrypoint-initdb.d
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
volumes:
|
|
db-data:
|