Skip to content

Commit 3bde861

Browse files
Use wait-for-it script to determine whether database container is up
1 parent f84ec50 commit 3bde861

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

docker-compose.yml

-8
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,10 @@ services:
1414
ports:
1515
- "33061:3306"
1616
command: --default-authentication-plugin=mysql_native_password
17-
healthcheck:
18-
test: ["CMD", "mysql", "-ubudget", "-ptest", "--execute", "SHOW DATABASES;"]
19-
interval: 3s
20-
timeout: 3s
21-
retries: 5
2217

2318
app:
2419
build:
2520
context: .
2621
dockerfile: docker/Dockerfile
27-
depends_on:
28-
database:
29-
condition: service_healthy
3022
ports:
3123
- "8080:80"

docker/entrypoint.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ fi
88

99
php artisan config:cache
1010

11-
php artisan migrate --force
11+
databaseHost=$(awk -F= '$1 == "MYSQL_HOST" {print $2}' .env)
12+
databasePort=$(awk -F= '$1 == "MYSQL_PORT" {print $2}' .env)
13+
14+
./docker/wait-for-it.sh $databaseHost:$databasePort -t 90 -- php artisan migrate --force
1215

1316
supervisord -n -c docker/supervisord.conf
1417

File renamed without changes.

0 commit comments

Comments
 (0)