-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
49 lines (36 loc) · 1.18 KB
/
docker-compose.yml
File metadata and controls
49 lines (36 loc) · 1.18 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
# docker-compose.yml
services:
# Backend service (Node.js API)
backend:
# Build the backend container using the Dockerfile inside the backend folder
build: ./server
# Map the container port 3000 to the host port 3000
ports:
- "3000:3000"
# Create a container named 'backend' for easier reference
container_name: backend
# Connect the backend to the shared app network
networks:
- app-network
# Frontend service (React app)
frontend:
# Build the frontend container using the Dockerfile inside the frontend folder
build: ./client
# Map the container port 3001 to the host port 3001
ports:
- "3001:3001"
# Wait for the backend service to start before running the frontend
depends_on:
- backend
# Set environment variable(s) for the frontend
environment:
- PORT=3001
# Create a container named 'frontend' for easier reference
container_name: frontend
# Connect the frontend to the same app network
networks:
- app-network
# Define a shared network so both containers can communicate (Docker does this automatically by default)
networks:
app-network:
driver: bridge