-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
103 lines (98 loc) · 2.52 KB
/
docker-compose.yml
File metadata and controls
103 lines (98 loc) · 2.52 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
services:
# PostgreSQL Database
postgres:
image: postgres:16-alpine
container_name: code-sharing-postgres
environment:
POSTGRES_DB: code_sharing_platform
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
PGDATA: /var/lib/postgresql/data/pgdata
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
networks:
- code-sharing-network
# MongoDB
mongodb:
image: mongo:7
container_name: code-sharing-mongodb
environment:
MONGO_INITDB_DATABASE: code_sharing_platform
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: password
ports:
- "27017:27017"
volumes:
- mongo_data:/data/db
- mongo_config:/data/configdb
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 10s
timeout: 5s
retries: 5
networks:
- code-sharing-network
# Backend Service
backend:
build:
context: .
dockerfile: backend/Dockerfile
container_name: code-sharing-backend
environment:
SPRING_DATASOURCE_URL: jdbc:postgresql://postgres:5432/code_sharing_platform
SPRING_DATASOURCE_USERNAME: postgres
SPRING_DATASOURCE_PASSWORD: postgres
SPRING_DATA_MONGODB_URI: mongodb://root:password@mongodb:27017/code_sharing_platform?authSource=admin
JWT_SECRET_KEY: your-secret-key-change-in-production-$(date +%s)
JWT_EXPIRATION: 86400000
SERVER_PORT: 8080
LOGGING_LEVEL_COM_CODESHARING_PLATFORM: DEBUG
ports:
- "8080:8080"
depends_on:
postgres:
condition: service_healthy
mongodb:
condition: service_healthy
volumes:
- ./backend/src:/app/src
networks:
- code-sharing-network
restart: unless-stopped
# Frontend Service
frontend:
build:
context: .
dockerfile: frontend/Dockerfile
container_name: code-sharing-frontend
environment:
VITE_API_BASE_URL: https://localhost/api
VITE_WS_URL: wss://localhost
ports:
- "80:80"
- "443:443"
- "8000:8000"
depends_on:
- backend
volumes:
- ./certs:/etc/nginx/certs:ro
networks:
- code-sharing-network
restart: unless-stopped
volumes:
postgres_data:
driver: local
mongo_data:
driver: local
mongo_config:
driver: local
networks:
code-sharing-network:
driver: bridge