-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
102 lines (102 loc) · 2.5 KB
/
docker-compose.yml
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
version: "3.8"
services:
db:
container_name: db
image: "postgres:alpine"
environment:
- POSTGRES_DB=${DOCKER_POSTGRES_DB}
- POSTGRES_USER=${DOCKER_POSTGRES_USER}
- POSTGRES_PASSWORD=${DOCKER_POSTGRES_PASSWORD}
- PGDATA=${DOCKER_PGDATA}
deploy:
resources:
limits:
cpus: "0.50"
memory: 200M
reservations:
memory: 100M
networks:
- webappnetwork
volumes:
- ./database/db.sql:/docker-entrypoint-initdb.d/init.sql # Use this if you want to spin up a container and have some initialization satements(eg make tables, insert data, etc)
- dbvolume:/var/lib/postgresql/data # using named volume to persist data; run `docker volume create dbvolume` before `docker-compose up`
command: ["postgres", "-c", "log_statement=all"] # To see all the commands running on our db live
ports:
- "5432:5432"
redis:
container_name: redis
image: "redislabs/rejson:latest"
deploy:
resources:
limits:
cpus: "0.20"
memory: 200M
reservations:
memory: 100M
networks:
- webappnetwork
backend:
container_name: backend
restart: always
deploy:
resources:
limits:
cpus: "0.20"
memory: 500M
reservations:
memory: 100M
build:
context: ./backend
target: dev
# command: uvicorn main:app --reload --workers 1 --host 0.0.0.0 --port 8000
# command: ls -al /usr/src/app/output
environment:
- MAX_ROWS=${DOCKER_MAX_ROWS}
- CACHE_MINUTES=${DOCKER_CACHE_MINUTES}
- TORTOISEORM_DSN=${DOCKER_DSN}
# expose:
# - "8000"
ports:
- "8000:8000"
# environment:
# - CHOKIDAR_USEPOLLING=true
volumes:
- ./backend/app:/usr/src/app/app
networks:
- webappnetwork
depends_on:
- redis
- db
frontend:
container_name: frontend
deploy:
resources:
limits:
cpus: "0.60"
memory: 1000M
reservations:
memory: 1000M
stdin_open: true
build:
context: ./frontend
command: npm start
# command: ls -al /usr/src/app
# expose:
# - "3000"
ports:
- "3000:3000"
environment:
- CHOKIDAR_USEPOLLING=true
volumes:
- "./frontend:/usr/src/app"
- "/usr/src/app/node_modules/"
networks:
- webappnetwork
depends_on:
- backend
networks:
webappnetwork:
driver: bridge
volumes:
dbvolume:
external: true