-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yaml
More file actions
112 lines (105 loc) · 2.42 KB
/
docker-compose.prod.yaml
File metadata and controls
112 lines (105 loc) · 2.42 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
103
104
105
106
107
108
109
110
111
112
# Production Docker Compose
# Usage: docker compose -f docker-compose.prod.yaml up -d
services:
caddy:
image: caddy:2-alpine
container_name: nxtchess_caddy
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy_data:/data
- caddy_config:/config
depends_on:
- frontend
- backend
networks:
- nxtchess_network
mem_limit: 128m
cpus: 0.25
frontend:
build:
context: ./apps/frontend
dockerfile: Dockerfile
args:
VITE_BACKEND_URL: ""
container_name: nxtchess_frontend
restart: unless-stopped
environment:
PROXY_BACKEND_URL: ${PROXY_BACKEND_URL:-http://backend:8080}
expose:
- "80"
networks:
- nxtchess_network
mem_limit: 256m
cpus: 0.5
backend:
build:
context: .
dockerfile: backend.Dockerfile
container_name: nxtchess_backend
restart: unless-stopped
env_file: .env.prod
expose:
- "8080"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
networks:
- nxtchess_network
mem_limit: 512m
cpus: 0.5
db:
image: postgres:15-alpine
container_name: nxtchess_db
restart: unless-stopped
environment:
POSTGRES_DB: ${DB_NAME:-chess_db}
POSTGRES_USER: ${DB_USER:-postgres}
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- db_data:/var/lib/postgresql/data
- ./db/init.sql:/docker-entrypoint-initdb.d/init.sql:ro
expose:
- "5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres} -d ${DB_NAME:-chess_db}"]
interval: 5s
timeout: 5s
retries: 5
networks:
- nxtchess_network
mem_limit: 1g
cpus: 1.0
redis:
image: redis:7-alpine
container_name: nxtchess_redis
restart: unless-stopped
command: redis-server --requirepass ${REDIS_PASSWORD} --appendonly yes
expose:
- "6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD-SHELL", "REDISCLI_AUTH=$$REDIS_PASSWORD redis-cli ping | grep -q PONG"]
interval: 5s
timeout: 5s
retries: 5
environment:
REDIS_PASSWORD: ${REDIS_PASSWORD}
networks:
- nxtchess_network
mem_limit: 256m
cpus: 0.25
networks:
nxtchess_network:
driver: bridge
volumes:
db_data:
redis_data:
caddy_data:
caddy_config: