-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
70 lines (67 loc) · 2.14 KB
/
Copy pathdocker-compose.yml
File metadata and controls
70 lines (67 loc) · 2.14 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
services:
db:
image: postgres:16-alpine@sha256:57c72fd2a128e416c7fcc499958864df5301e940bca0a56f58fddf30ffc07777
environment:
# Development defaults. Override all four database settings together.
POSTGRES_USER: ${POSTGRES_USER:-talkwithdata}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-talkwithdata}
POSTGRES_DB: ${POSTGRES_DB:-talkwithdata}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test:
- CMD-SHELL
- pg_isready -U "$${POSTGRES_USER}" -d "$${POSTGRES_DB}"
interval: 2s
timeout: 3s
retries: 15
start_period: 10s
restart: unless-stopped
migrate:
build:
context: .
dockerfile: app/Dockerfile
target: migrator
environment:
DATABASE_URL: ${COMPOSE_DATABASE_URL:-postgresql://talkwithdata:talkwithdata@db:5432/talkwithdata}
depends_on:
db:
condition: service_healthy
restart: "no"
command:
- sh
- -c
- echo 'TWD migration run' && exec ./node_modules/.bin/prisma migrate deploy
app:
build:
context: .
dockerfile: app/Dockerfile
# Cloud Run expects PORT=8080
ports:
- "${TWD_APP_PORT:-3000}:8080"
env_file:
- ${TWD_ENV_FILE:-./app/.env}
environment:
# LOCAL_STORAGE_ROOT is used when STORAGE_PROVIDER=local in the env file.
# The named volume keeps dashboard files across container replacements.
DATABASE_URL: ${COMPOSE_DATABASE_URL:-postgresql://talkwithdata:talkwithdata@db:5432/talkwithdata}
LOCAL_STORAGE_ROOT: /data/uploads
PORT: 8080
depends_on:
migrate:
condition: service_completed_successfully
volumes:
- app_data:/data
restart: unless-stopped
# Liveness probe for observability (docker compose ps, depends_on gating).
# Compose does not restart unhealthy containers, and /api/health does not
# check the database, so healthy means the app is serving, not DB-ready.
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8080/api/health"]
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
volumes:
app_data:
postgres_data: