Repository navigation
Expand file tree
/
Copy pathcompose.yaml
More file actions
58 lines (55 loc) · 1.49 KB
/
Copy pathcompose.yaml
File metadata and controls
58 lines (55 loc) · 1.49 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
services:
db:
image: postgres:18-alpine
restart: unless-stopped
environment:
POSTGRES_USER: ${SERVICE_USER_POSTGRES:-app}
POSTGRES_PASSWORD: ${SERVICE_PASSWORD_POSTGRES:-app}
POSTGRES_DB: ${POSTGRES_DB:-app}
volumes:
- db-data:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 10
backend:
build:
context: backend
restart: unless-stopped
environment:
ENVIRONMENT: production
PORT: 3000
DATABASE_URL: postgresql://${SERVICE_USER_POSTGRES:-app}:${SERVICE_PASSWORD_POSTGRES:-app}@db:5432/${POSTGRES_DB:-app}?sslmode=disable
LOG_LEVEL: ${LOG_LEVEL:-info}
depends_on:
db:
condition: service_healthy
healthcheck:
test:
[
"CMD",
"python",
"-c",
"import urllib.request; urllib.request.urlopen('http://127.0.0.1:3000/api/v1/health', timeout=4)",
]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
web:
build:
context: .
dockerfile: frontend/Dockerfile
restart: unless-stopped
depends_on:
backend:
condition: service_healthy
healthcheck:
# Alpine resolves localhost to IPv6 first, but nginx only listens on IPv4.
test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1:8080/"]
interval: 10s
timeout: 5s
retries: 5
volumes:
db-data: