Skip to content

Commit 907c8f2

Browse files
committed
Check db health to avoid start without db
1 parent f36b9e9 commit 907c8f2

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

.devcontainer/docker-compose.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ services:
1313
ports:
1414
- 80:80
1515
depends_on:
16-
- db
17-
- mailhog
18-
16+
db:
17+
condition: service_healthy
18+
mailhog:
19+
condition: service_started
20+
1921
db:
2022
image: postgres
2123
restart: always
@@ -26,14 +28,21 @@ services:
2628
- ../../data/db:/data/postgres
2729
expose:
2830
- "5432"
29-
31+
healthcheck:
32+
test: ["CMD-SHELL", "pg_isready"]
33+
interval: 10s
34+
timeout: 5s
35+
retries: 10
36+
37+
3038
adminer:
3139
image: adminer
3240
restart: always
3341
ports:
3442
- 8080:8080
3543
depends_on:
36-
- db
44+
db:
45+
condition: service_healthy
3746

3847
mailhog:
3948
image: mailhog/mailhog

0 commit comments

Comments
 (0)