-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
45 lines (40 loc) · 1.09 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
version: '3.9'
services:
backend:
build:
context: ./backend
dockerfile: Dockerfile
ports:
- "3000:3000" # Expose the backend on port 3000
env_file:
- ./backend/.env # Load environment variables for the backend
depends_on:
- mongo # Ensure MongoDB starts before the backend
networks:
- app-network
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
ports:
- "5173:5173" # Expose the frontend on port 5173
env_file:
- ./frontend/.env # Load environment variables for the frontend
depends_on:
- backend # Ensure the backend is running before starting the frontend
networks:
- app-network
mongo:
image: mongo # Use the official MongoDB image
container_name: mongo # Name the MongoDB container
ports:
- "27017:27017" # Expose MongoDB on port 27017
volumes:
- mongo-data:/data/db # Persist MongoDB data
networks:
- app-network
volumes:
mongo-data:
# Named volume to persist MongoDB data
networks:
app-network: # Shared network for all services