-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
74 lines (69 loc) · 1.73 KB
/
docker-compose.prod.yml
File metadata and controls
74 lines (69 loc) · 1.73 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
name: cfchem-prod
services:
db:
image: unmtransinfo/cfchemdb_db
container_name: cfchem_db
volumes:
- cfchem_db_data:/var/lib/postgresql/data
networks:
- backend
restart: unless-stopped
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}" ]
interval: 30s
timeout: 10s
retries: 10
deploy:
resources:
limits:
cpus: "4"
memory: 8G
api:
image: unmtransinfo/cfchem_api:latest
depends_on:
db:
condition: service_healthy
volumes:
- static_files_flasgger:/app/flasgger_static/
environment:
- APP_PORT=${APP_PORT}
- DB_HOST=db # host is docker service
- DB_NAME=${DB_NAME}
- DB_USER=${DB_USER}
- DB_PASSWORD=${DB_PASSWORD}
- DB_PORT=5432 # cfchemdb has been hard-coded to be on 5432
env_file:
- .env
ports:
- "127.0.0.1:${APP_PORT}:${APP_PORT}"
networks:
- backend
command: gunicorn --bind "0.0.0.0:${APP_PORT}" --workers ${N_WORKERS} --max-requests ${MAX_REQUESTS} --preload app:app
restart: unless-stopped
healthcheck:
test: [ "CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:${APP_PORT:-8000}/api/v1/health/').read()" ]
interval: 30s
timeout: 10s
retries: 5
deploy:
resources:
limits:
cpus: "2"
memory: 2G
ui:
image: unmtransinfo/cfchem_ui:latest
depends_on:
api:
condition: service_healthy
volumes:
- /var/www/cfchem:/app/dist/
env_file:
- .env
command: npx vite build
restart: no
networks:
backend:
driver: bridge # default
volumes:
static_files_flasgger:
cfchem_db_data: