Skip to content

Commit

Permalink
Added check on container health
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoGuideri committed Nov 7, 2024
1 parent c5d0a97 commit 5e30339
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion server/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ services:
ports:
- "${HOST_PHP_PORT}:80"
depends_on:
- db
db:
condition: service_healthy
env_file:
- .env

Expand All @@ -14,6 +15,10 @@ services:
- "${HOST_MYSQL_PORT}:${MYSQL_PORT}"
env_file:
- .env
healthcheck:
test: ["CMD-SHELL", "mysql --user=$MYSQL_USER --password=$MYSQL_PASSWORD --execute='SELECT 1;'"]
interval: 5s
retries: 10
volumes:
- db_data:/var/lib/mysql

Expand Down
2 changes: 1 addition & 1 deletion server/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ export MYSQL_PASSWORD='banana'
export MYSQL_ROOT_PASSWORD='banana'

export HOST_PHP_PORT=1984
export HOST_MYSQL_PORT=3306
export HOST_MYSQL_PORT=3307

0 comments on commit 5e30339

Please sign in to comment.