-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
89 lines (85 loc) · 2.25 KB
/
docker-compose.yml
File metadata and controls
89 lines (85 loc) · 2.25 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
services:
# MongoDB Database
mongodb:
image: mongo:7.0
container_name: portfolio-mongodb
restart: unless-stopped
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_ROOT_PASSWORD}
MONGO_INITDB_DATABASE: portfolio
volumes:
- mongodb_data:/data/db
- ./mongodb-init:/docker-entrypoint-initdb.d
ports:
- "27017:27017"
networks:
- portfolio-network
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh --quiet
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Backend Service
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: portfolio-backend
restart: unless-stopped
depends_on:
mongodb:
condition: service_healthy
environment:
SPRING_PROFILES_ACTIVE: dev
MONGODB_URI: mongodb://mongodb:27017/portfolio_dev
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
JWT_SECRET: ${JWT_SECRET}
CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS:-http://localhost:3000,http://localhost:5173}
ports:
- "8080:8080"
networks:
- portfolio-network
volumes:
- ./logs/backend:/app/logs
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:8080/actuator/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
# Frontend Service
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
args:
VITE_API_BASE_URL: ${VITE_API_BASE_URL:-http://localhost:8080/api}
VITE_GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
VITE_GA_MEASUREMENT_ID: ${GA_MEASUREMENT_ID}
VITE_USE_BACKEND_API: "true"
container_name: portfolio-frontend
restart: unless-stopped
depends_on:
backend:
condition: service_healthy
ports:
- "80:80"
networks:
- portfolio-network
volumes:
- ./logs/frontend:/var/log/nginx
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:80/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
volumes:
mongodb_data:
driver: local
networks:
portfolio-network:
driver: bridge