-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker-compose.yml
117 lines (108 loc) · 4.79 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Specify the version of the Docker Compose.
version: "3.9"
# Define the services and applications that make up your application.
services:
question-service:
container_name: question-service
build: ./backend/question-service # Path to the directory containing the Dockerfile for building the question-service image.
ports:
- 5000:5000 # Maps port 5000 on the host to port 5000 in the container, making the app accessible on the host.
volumes:
- ./backend/question-service:/app # Mounts the host directory './backend/question-service' to '/app' in the container.
- /app/node_modules # Anonymous Volume
networks:
- peerprep-network # Connects the question-service to the 'peerprep-network' network.
user-service:
container_name: user-service
build: ./backend/user-service # Path to the directory containing the Dockerfile for building the user-service image.
ports:
- 5001:5001 # Maps port 5001 on the host to port 5001 in the container, making the app accessible on the host.
volumes:
- ./backend/user-service:/app # Mounts the host directory './backend/user-service' to '/app' in the container.
- /app/node_modules # Anonymous Volume
networks:
- peerprep-network # Connects the user-service to the 'peerprep-network' network.
rabbitmq:
image: rabbitmq:3-management
container_name: rabbitmq
ports:
- 5672:5672 # rabbitmq server port
- 15672:15672 # rabbitmq management port
volumes:
- rabbitmq_data:/var/lib/rabbitmq
networks:
- peerprep-network # Connects rabbitmq server to the 'peerprep-network' network.
healthcheck: # check status of rabbitmq server
test: rabbitmq-diagnostics check_port_connectivity
interval: 1s
timeout: 5s
retries: 10
start_period: 10s
matching-service:
container_name: matching-service
environment:
- RABBIT_HOSTNAME=rabbitmq # URL to connect to rabbitmq container in the network
- API_GATEWAY_URL=http://api-gateway:8000
depends_on: # condition to wait for rabbitmq container to be ready
rabbitmq:
condition: service_healthy
build: ./backend/matching-service # Path to the directory containing the Dockerfile for building the matching-service image.
volumes:
- ./backend/matching-service:/app # Mounts the host directory './backend/matching-service' to '/app' in the container.
- /app/node_modules # Anonymous Volume
networks:
- peerprep-network # Connects the matching-service to the 'peerprep-network' network.
collaboration-service:
container_name: collaboration-service
environment:
- URL_QUESTION_SERVICE=http://question-service:5000/question
- API_GATEWAY_URL=http://api-gateway:8000
build: ./backend/collaboration-service # Path to the directory containing the Dockerfile for building the collaboration-service image.
ports:
- 5003:5003 # Maps port 5003 on the host to port 5003 in the container, making the app accessible on the host.
volumes:
- ./backend/collaboration-service:/app # Mounts the host directory './backend/collaboration-service' to '/app' in the container.
- /app/node_modules # Anonymous Volume
networks:
- peerprep-network # Connects the collaboration-service to the 'peerprep-network' network.
api-gateway:
container_name: api-gateway
environment:
- QUESTION_SERVICE_URL=http://question-service:5000/question
- USER_SERVICE_URL=http://user-service:5001/user
- COLLABORATION_SERVICE_URL=http://collaboration-service:5003/collaboration
depends_on:
question-service:
condition: service_started
user-service:
condition: service_started
collaboration-service:
condition: service_started
build: ./backend/api-gateway # Path to the directory containing the Dockerfile for building the api-gateway image.
ports:
- 8000:8000 # Maps port 8000 on the host to port 8000 in the container, making the app accessible on the host.
volumes:
- ./backend/api-gateway:/app # Mounts the host directory './backend/api-gateway' to '/app' in the container.
- /app/node_modules # Anonymous Volume
networks:
- peerprep-network # Connects the api-gateway to the 'peerprep-network' network.
frontend:
container_name: frontend
environment:
- REACT_APP_API_GATEWAY_URL=http://localhost:8000
build: ./frontend
ports:
- 3000:3000
volumes:
- ./frontend:/app
- /app/node_modules
networks:
- peerprep-network
depends_on:
- api-gateway
volumes:
rabbitmq_data:
networks:
peerprep-network: # Defines a network named 'peerprep-network'.
name: peerprep-network
driver: bridge # Uses the bridge driver for the network, which is the default and most common network type in Docker.