-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
111 lines (103 loc) · 2.35 KB
/
docker-compose.yml
File metadata and controls
111 lines (103 loc) · 2.35 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
services:
# MongoDB database
mongo:
profiles: ["web_app"]
image: mongo:6
container_name: mongo
volumes:
- mongo_data:/data/db
ports:
- "27017:27017"
networks:
- gmail-net
# React frontend
web_front:
profiles: ["web_app"]
build:
context: frontend
dockerfile: Dockerfile
container_name: react_frontend
depends_on:
- web_server
env_file:
- ./frontend/.env
ports:
- "${REACT_APP_PORT:-3000}:3000"
networks:
- gmail-net
# Web server using JS express
web_server:
profiles: ["web_app"]
build:
context: ./web_server
dockerfile: Dockerfile
container_name: web_server
env_file:
- ./web_server/.env
depends_on:
- run_server
- mongo
environment:
- MONGO_URI=mongodb://mongo:27017/appdb
ports:
- "${NODE_PORT:-3001}:3001"
networks:
- gmail-net
# Server itself (CPP)
run_server:
profiles: ["web_app", "tests"]
build:
context: ./server_cpp
dockerfile: Dockerfile
container_name: gmail_server
stdin_open: true # <-- keeps stdin open
tty: true # <-- allocates a pseudo-TTY
volumes:
- app_data:/usr/src/run_server # <-- only the "data" folder is persisted between runs
ports:
- "12347:12347"
networks:
- gmail-net
# Server gtest
gtest:
profiles: [ "tests" ]
build:
context: ./server_cpp
dockerfile: Dockerfile_test
container_name: gmail_tests
# Prevent the use of terminal input during test runs
stdin_open: false
tty: false
# Client (Python)
python_client:
profiles: [ "client" ]
build:
context: ./python_client
dockerfile: Dockerfile
# container_name: python_client
depends_on:
- run_server
stdin_open: true
tty: true
environment:
- SERVER_HOST=run_server
- SERVER_PORT=12347
- PYTHON=/python_client
command: [ "python", "main.py", "run_server", "12347" ]
networks:
- gmail-net
# Client test runner (Python).
test_client:
profiles: [ "tests" ]
build:
context: ./python_client
dockerfile: Dockerfile.tests
container_name: client_tests
depends_on:
- run_server
command: ["python","tests/test_client_unittest.py"]
volumes:
app_data:
mongo_data:
networks:
gmail-net: