-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
68 lines (63 loc) · 1.54 KB
/
Copy pathdocker-compose.yml
File metadata and controls
68 lines (63 loc) · 1.54 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
version: '3.8'
services:
# MongoDB database
mongodb:
image: mongo:7-alpine
container_name: bodybuilding-db
ports:
- "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: password
MONGO_INITDB_DATABASE: bodybuilding
volumes:
- mongodb_data:/data/db
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 10s
timeout: 5s
retries: 5
# Node.js Backend
server:
build:
context: .
dockerfile: Dockerfile
container_name: bodybuilding-server
ports:
- "3000:3000"
environment:
NODE_ENV: development
PORT: 3000
MONGO_URI: mongodb://admin:password@mongodb:27017/bodybuilding?authSource=admin
JWT_SECRET: your-dev-secret-key-change-in-production
JWT_EXPIRES_IN: 7d
CLIENT_ORIGIN: http://localhost:5173
depends_on:
mongodb:
condition: service_healthy
volumes:
- ./server:/app/server
- /app/node_modules
restart: unless-stopped
# React Frontend (dev mode)
client:
build:
context: ./client
dockerfile: Dockerfile.dev
container_name: bodybuilding-client
ports:
- "5173:5173"
environment:
VITE_API_BASE_URL: http://localhost:3000/api
volumes:
- ./client/src:/app/src
- ./client/public:/app/public
- /app/node_modules
depends_on:
- server
restart: unless-stopped
volumes:
mongodb_data:
networks:
default:
name: bodybuilding-network