Skip to content

Commit

Permalink
feat:DBのセットアップを待つようにdepends onを追加しました.同様の理由でヘルスチェックを追加しました.
Browse files Browse the repository at this point in the history
  • Loading branch information
shin0729 committed Mar 2, 2024
1 parent 95e6481 commit 31a3896
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
9 changes: 8 additions & 1 deletion typing-server/docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
services:
api:
depends_on:
- db
db:
condition: service_healthy
build:
context: .
dockerfile: Dockerfile
Expand All @@ -15,6 +16,12 @@ services:
extra_hosts:
- 'db:172.28.1.5'
db:
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
retries: 10
start_period: 30s

image: mysql:8.3.0
environment:
MYSQL_DATABASE: typing-db
Expand Down
11 changes: 10 additions & 1 deletion typing-server/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
services:
api:
depends_on:
db:
condition: service_healthy
build:
context: .
dockerfile: Dockerfile
Expand All @@ -13,14 +16,20 @@ services:
extra_hosts:
- 'db:172.28.1.5'
db:
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
retries: 10
start_period: 30s

image: mysql:8.3.0
environment:
MYSQL_DATABASE: typing-db
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: password
ports:
- "33061:3306"
- "3307:3306"
volumes:
- db-data:/var/lib/mysql
networks:
Expand Down

0 comments on commit 31a3896

Please sign in to comment.