-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
117 lines (110 loc) · 2.65 KB
/
Copy pathdocker-compose.yml
File metadata and controls
117 lines (110 loc) · 2.65 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
117
services:
postgres:
image: postgres:16-alpine
restart: unless-stopped
volumes:
- pgdata:/var/lib/postgresql/data
environment:
POSTGRES_DB: ${POSTGRES_DB:-bulk_email}
POSTGRES_USER: ${POSTGRES_USER:-bulk_email_user}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-bulk_email_user}"]
interval: 5s
timeout: 3s
retries: 5
networks:
- backend
redis:
image: redis:7-alpine
restart: unless-stopped
command: redis-server --maxmemory 256mb --maxmemory-policy noeviction
volumes:
- redisdata:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
networks:
- backend
server:
build:
context: ./server
dockerfile: Dockerfile
restart: unless-stopped
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
environment:
NODE_ENV: production
DATABASE_URL: postgresql://${POSTGRES_USER:-bulk_email_user}:${POSTGRES_PASSWORD:-changeme}@postgres:5432/${POSTGRES_DB:-bulk_email}
REDIS_URL: redis://redis:6379
PORT: 3001
UPLOAD_DIR: /app/uploads
env_file:
- path: .env.production
required: false
volumes:
- uploads:/app/uploads
networks:
- backend
- frontend
worker:
build:
context: ./server
dockerfile: Dockerfile
restart: unless-stopped
command: node dist/workers/index.js
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
environment:
NODE_ENV: production
DATABASE_URL: postgresql://${POSTGRES_USER:-bulk_email_user}:${POSTGRES_PASSWORD:-changeme}@postgres:5432/${POSTGRES_DB:-bulk_email}
REDIS_URL: redis://redis:6379
UPLOAD_DIR: /app/uploads
healthcheck:
test: ["CMD-SHELL", "pgrep -f 'node dist/workers' || exit 1"]
interval: 30s
timeout: 10s
retries: 3
env_file:
- path: .env.production
required: false
volumes:
- uploads:/app/uploads
networks:
- backend
client:
build:
context: ./client
dockerfile: Dockerfile
restart: unless-stopped
networks:
- frontend
nginx:
image: nginx:alpine
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- server
- client
networks:
- frontend
- backend
volumes:
pgdata:
redisdata:
uploads:
networks:
backend:
frontend: