-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
67 lines (55 loc) · 1.73 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
67 lines (55 loc) · 1.73 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
# Production compose — DigitalOcean Droplet
# Run with: docker compose -f docker-compose.prod.yml up -d
services:
# ---------------------------------------------------------------------------
# nginx — the only service exposed to the internet.
# Handles HTTPS, SSL termination, and proxies to the app.
# ---------------------------------------------------------------------------
nginx:
image: nginx:alpine
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx/certbot/conf:/etc/letsencrypt:ro
- ./nginx/certbot/www:/var/www/certbot:ro
depends_on:
app:
condition: service_healthy
app:
image: ${APP_IMAGE}
restart: always
expose:
- "3000"
env_file:
- .env.production
healthcheck:
test: [ "CMD-SHELL", "curl -f http://localhost:3000 || exit 1" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
depends_on:
db:
condition: service_healthy
db:
image: postgres:16-alpine
restart: always
env_file:
- .env.production
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASS=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
volumes:
- postgres-data:/var/lib/postgresql/data
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER}" ]
interval: 15s
timeout: 5s
retries: 3
# Named volumes
volumes:
postgres-data: