Skip to content

Commit

Permalink
Use wait-for-it script to determine whether database container is up
Browse files Browse the repository at this point in the history
  • Loading branch information
range-of-motion committed Dec 3, 2023
1 parent c0b6641 commit b20eb46
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
8 changes: 0 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,10 @@ services:
ports:
- "33061:3306"
command: --default-authentication-plugin=mysql_native_password
healthcheck:
test: ["CMD", "mysql", "-ubudget", "-ptest", "--execute", "SHOW DATABASES;"]
interval: 3s
timeout: 3s
retries: 5

app:
build:
context: .
dockerfile: docker/Dockerfile
depends_on:
database:
condition: service_healthy
ports:
- "8080:80"
5 changes: 4 additions & 1 deletion docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ fi

php artisan config:cache

php artisan migrate --force
databaseHost=$(awk -F= '$1 == "DB_HOST" {print $2}' .env)
databasePort=$(awk -F= '$1 == "DB_PORT" {print $2}' .env)

./docker/wait-for-it.sh $databaseHost:$databasePort -t 90 -- php artisan migrate --force

supervisord -n -c docker/supervisord.conf

Expand Down
File renamed without changes.

0 comments on commit b20eb46

Please sign in to comment.