-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
116 lines (111 loc) · 3.08 KB
/
docker-compose.prod.yml
File metadata and controls
116 lines (111 loc) · 3.08 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
113
114
115
116
# =============================================================
# API-Watch — Production Docker Compose
# Usage:
# cp .env.production.example .env.production
# # Edit .env.production with real values
# docker compose -f docker-compose.prod.yml up -d
# =============================================================
services:
# ── Application ──────────────────────────────────────────────
api-watch:
build:
context: .
dockerfile: Dockerfile
args:
VITE_API_URL: ${VITE_API_URL:-}
image: ghcr.io/<your-github-username>/api-watch:latest
container_name: apiwatch-app
restart: unless-stopped
ports:
- "${PORT:-8000}:${PORT:-8000}"
env_file:
- .env.production
environment:
- PORT=${PORT:-8000}
volumes:
- app-data:/app/data
- app-logs:/app/logs
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:${PORT:-8000}/health"]
interval: 30s
timeout: 5s
start_period: 15s
retries: 3
deploy:
resources:
limits:
memory: 512M
cpus: "1.0"
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
networks:
- apiwatch-net
# ── PostgreSQL ───────────────────────────────────────────────
postgres:
image: postgres:16-alpine
container_name: apiwatch-postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-apiwatch}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env.production}
POSTGRES_DB: ${POSTGRES_DB:-apiwatch}
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-apiwatch}"]
interval: 5s
timeout: 3s
retries: 5
deploy:
resources:
limits:
memory: 256M
cpus: "0.5"
logging:
driver: json-file
options:
max-size: "5m"
max-file: "3"
networks:
- apiwatch-net
# ── Redis ────────────────────────────────────────────────────
redis:
image: redis:7-alpine
container_name: apiwatch-redis
restart: unless-stopped
command: redis-server --maxmemory 64mb --maxmemory-policy allkeys-lru
volumes:
- redisdata:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
deploy:
resources:
limits:
memory: 128M
cpus: "0.25"
logging:
driver: json-file
options:
max-size: "5m"
max-file: "3"
networks:
- apiwatch-net
volumes:
pgdata:
redisdata:
app-data:
app-logs:
networks:
apiwatch-net:
driver: bridge