-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
43 lines (40 loc) · 1.07 KB
/
docker-compose.yml
File metadata and controls
43 lines (40 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
services:
db:
image: postgres:latest
environment:
POSTGRES_USER: admin
POSTGRES_PASSWORD: password
POSTGRES_DB: mydb
ports:
- "5432:5432"
healthcheck:
test: pg_isready -U admin -d mydb
interval: 3s
timeout: 3s
retries: 5
server:
build:
context: ./server
dockerfile: Dockerfile
environment:
- DATABASE_URL=postgresql://admin:password@db:5432/mydb?schema=public
- WEB_ORIGIN=http://localhost:5173
ports:
- "3000:3000"
command: >
sh -c "npx prisma db push && npx prisma db seed && npm run dev"
depends_on:
db:
condition: service_healthy
web:
build:
context: ./web
dockerfile: Dockerfile
args:
- VITE_API_URL=http://localhost:3000
ports:
- "5173:5173"
command: >
sh -c "npm run dev"
# 開発時は5173ポートを転送し、ブラウザを通してローカル環境からserverにリクエストされる
# その場合はDocker Network内の通信ではなくなるのでlocalhostをホストに指定する