-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
66 lines (61 loc) · 1.51 KB
/
Copy pathdocker-compose.yaml
File metadata and controls
66 lines (61 loc) · 1.51 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
version: '3.8'
services:
web_api:
image: maialenigar/web_api:v2
build: .
ports:
- 7007-7015:7007 # We set a range of ports so that when scaling, we can use them
env_file:
- .env
depends_on:
- mongodb
networks:
- my-network
deploy:
resources:
limits:
cpus: '0.5' # Limit CPU usage to 50%
memory: 256M # Limit memory usage to 256 megabytes
mongodb:
image: mongo:4.0.7
container_name: mongodb-container
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD_FILE: /run/secrets/mongodb_root_password
MONGO_INITDB_DATABASE: testdb
volumes:
- mongodb-volume:/data/db
ports:
- 27017:27017
networks:
- my-network
deploy:
resources:
limits:
cpus: '0.5' # Limit CPU usage to 50%
memory: 512M # Limit memory usage to 512 megabytes
secrets:
- mongodb_root_password
mongo-express:
image: mongo-express:latest
container_name: mongo-express
environment:
ME_CONFIG_MONGODB_ADMINUSERNAME: root
ME_CONFIG_MONGODB_ADMINPASSWORD_FILE: /run/secrets/mongodb_root_password
ME_CONFIG_MONGODB_SERVER: mongodb # use the name of the mongo container
ports:
- 8081:8081
depends_on:
- mongodb
networks:
- my-network
secrets:
- mongodb_root_password
secrets:
mongodb_root_password:
file: ./mongo-pass.txt
volumes:
mongodb-volume:
networks:
my-network:
driver: bridge