chore: add container healthchecks and dependency conditions to docker-compose services
This commit is contained in:
@@ -7,10 +7,14 @@ services:
|
||||
image: truncgil-finance-app:latest
|
||||
container_name: truncgil-finance-app
|
||||
restart: always
|
||||
stop_grace_period: 1m
|
||||
volumes:
|
||||
- .:/var/www
|
||||
networks:
|
||||
- app-network
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
|
||||
web:
|
||||
image: nginx:alpine
|
||||
@@ -23,11 +27,14 @@ services:
|
||||
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
|
||||
networks:
|
||||
- app-network
|
||||
depends_on:
|
||||
- app
|
||||
|
||||
db:
|
||||
image: mysql:8.0
|
||||
container_name: truncgil-finance-db
|
||||
restart: unless-stopped
|
||||
stop_grace_period: 2m
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
MYSQL_DATABASE: truncgil_finance
|
||||
@@ -39,6 +46,12 @@ services:
|
||||
- app-network
|
||||
ports:
|
||||
- "3308:3306"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "mysqladmin ping -h localhost -u root -proot"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 10s
|
||||
|
||||
networks:
|
||||
app-network:
|
||||
|
||||
Reference in New Issue
Block a user