Skip to content

Commit 097a708

Browse files
committed
chore: app now waits till MySQL is up and runnning
Correction for 206d310 commit. Part of #13
1 parent 9480574 commit 097a708

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

docker/docker-compose.yaml

+11-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ services:
1919
- '3306:3306'
2020
volumes:
2121
- ./categories.mysql.sql:/docker-entrypoint-initdb.d/categories.sql
22+
healthcheck:
23+
# Specifying "MYSQL_PWD" variable suppresses "Warning: Using a password on the command line interface can be insecure"
24+
# Attention: MYSQL_PWD is deprecated as of MySQL 8.0; expect it to be removed in a future version of MySQL
25+
# Note: double dollar sign protects variables from docker compose interpolation
26+
test: "MYSQL_PWD=$$MYSQL_PASSWORD mysql --user=$$MYSQL_USER --silent --execute 'SELECT \"OK\" AS result'"
27+
interval: 1s
28+
timeout: 5s
29+
retries: 10
30+
start_period: 1s
2231

2332

2433
express-js:
@@ -32,4 +41,5 @@ services:
3241
ports:
3342
- '3010:3010'
3443
depends_on:
35-
- mysql
44+
mysql:
45+
condition: service_healthy

0 commit comments

Comments
 (0)