-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
102 lines (95 loc) · 2.39 KB
/
Copy pathdocker-compose.yml
File metadata and controls
102 lines (95 loc) · 2.39 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
---
services:
nginx:
container_name: nginx
build:
context: ./nginx
dockerfile: Dockerfile
ports:
- "80:80"
- "443:443"
volumes:
- static_volume:/app/staticfiles:ro
- media_volume:/app/media:ro
depends_on:
- backend
- frontend
restart: unless-stopped
networks:
- app-network
db:
container_name: db
image: postgres:15
environment:
POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- postgres_data:/var/lib/postgresql/data
- ./backups:/backups
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
networks:
- app-network
backend:
build:
context: ./backend
dockerfile: Dockerfile
ports:
- "8000"
env_file:
- .env
depends_on:
db:
condition: service_healthy
restart: unless-stopped
volumes:
- static_volume:/app/staticfiles
- media_volume:/app/media
- ./backups:/app/backups
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/projects/', timeout=10)"]
interval: 30s
timeout: 30s
start_period: 5s
retries: 3
networks:
- app-network
frontend:
container_name: frontend
build:
context: ./frontend
dockerfile: Dockerfile
restart: unless-stopped
depends_on:
- backend
networks:
- app-network
cloudflared:
container_name: cloudflared
image: cloudflare/cloudflared:latest
command: tunnel --origincert /run/secrets/cloudflare_origin_cert --credentials-file /run/secrets/cloudflare_tunnel_credentials --url http://nginx:80 run 3cc69b7d-b6bc-4708-90c3-fc77426e7391
secrets:
- cloudflare_tunnel_credentials
- cloudflare_origin_cert
restart: unless-stopped
networks:
- app-network
profiles:
- production # Only run when 'production' profile is active
volumes:
postgres_data:
static_volume:
media_volume:
networks:
app-network:
driver: bridge
secrets:
cloudflare_tunnel_credentials:
file: ./cloudflare_tunnel_credentials.json
cloudflare_origin_cert:
file: ./cloudflare_origin_cert.pem