-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathdocker-compose.production.yaml
executable file
·158 lines (149 loc) · 3.79 KB
/
docker-compose.production.yaml
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
services:
frontend:
build:
context: .
dockerfile: frontend/Dockerfile
env_file:
- .env
ports:
- "${FRONTEND_PORT}:${FRONTEND_PORT_DOCKER}"
depends_on:
backend:
condition: service_healthy
workflow:
condition: service_healthy
environment:
NODE_ENV: ${NODE_ENV:-production}
PORT: ${FRONTEND_PORT_DOCKER:-3000}
CI: "true"
backend:
build:
context: ./backend
dockerfile: Dockerfile
ports:
- "${REACT_APP_BACKEND_PORT}:${BACKEND_PORT_DOCKER}"
env_file:
- .env
depends_on:
mongo:
condition: service_started
volume-init:
condition: service_completed_successfully
volumes:
- logs:/app/logs
- shared-uploads:/app/shared-uploads
environment:
NODE_ENV: ${NODE_ENV:-production}
extra_hosts:
- "host.docker.internal:host-gateway"
healthcheck:
test: ["CMD", "curl", "-f", "http://${REACT_APP_BACKEND_HOST:-backend}:${BACKEND_PORT_DOCKER}/api/health"]
interval: 30s
timeout: 10s
retries: 5
start_period: 10s
redis:
image: redis:6.0-alpine
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 5
workflow:
build:
context: ./workflow
env_file:
- .env
ports:
- "${REACT_APP_WORKFLOW_PORT}:${WORKFLOW_PORT_DOCKER}"
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- logs:/app/logs
- shared-uploads:/app/shared-uploads:ro
- model_cache:/app/model_cache
depends_on:
volume-init:
condition: service_completed_successfully
python_image:
condition: service_completed_successfully
bash_image:
condition: service_completed_successfully
redis:
condition: service_healthy
environment:
- PYTHONPATH=/app
- REDIS_URL=redis://redis:6379/0
extra_hosts:
- "host.docker.internal:host-gateway"
healthcheck:
test: ["CMD", "curl", "-f", "http://${REACT_APP_WORKFLOW_HOST:-workflow}:${WORKFLOW_PORT_DOCKER}/health"]
interval: 30s
timeout: 10s
retries: 5
start_period: 5s
volume-init:
image: busybox
attach: false
volumes:
- ${COMPOSE_PROJECT_DIR}/logs:/logs
- ${COMPOSE_PROJECT_DIR}/shared-uploads:/shared-uploads
- ${COMPOSE_PROJECT_DIR}/model_cache:/model_cache
command: |
sh -c "
echo 'Starting volume initialization' &&
ls -la / &&
echo 'Creating directories' &&
mkdir -p /logs /shared-uploads /model_cache &&
echo 'Setting permissions' &&
chmod -R 755 /logs /shared-uploads /model_cache &&
chown -R 1000:1000 /logs /shared-uploads /model_cache &&
echo 'Finished volume initialization' &&
ls -la /logs /shared-uploads /model_cache
"
mongo:
image: mongo:latest
ports:
- "26017:27017"
volumes:
- mongo_data:/data/db
attach: false
python_image:
build:
context: .
dockerfile: workflow/Dockerfile.python
image: mypython:latest
command: ["bash"]
bash_image:
build:
context: .
dockerfile: workflow/Dockerfile.bash
image: mybash:latest
command: ["bash"]
javascript_image:
build:
context: .
dockerfile: workflow/Dockerfile.javascript
image: myjs:latest
command: ["bash"]
volumes:
mongo_data:
logs:
driver: local
driver_opts:
type: none
o: bind
device: ${COMPOSE_PROJECT_DIR}/logs
shared-uploads:
driver: local
driver_opts:
type: none
o: bind
device: ${COMPOSE_PROJECT_DIR}/shared-uploads
model_cache:
driver: local
driver_opts:
type: none
o: bind
device: ${COMPOSE_PROJECT_DIR}/model_cache