-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
151 lines (140 loc) · 3.97 KB
/
docker-compose.yaml
File metadata and controls
151 lines (140 loc) · 3.97 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
version: '3.8'
services:
# =========================================================================
# DATABASES
# =========================================================================
# Production/Development Database
db:
image: postgres:15-alpine
container_name: openrisk_db
environment:
POSTGRES_USER: ${DB_USER:-openrisk}
POSTGRES_PASSWORD: ${DB_PASSWORD:-openrisk}
POSTGRES_DB: ${DB_NAME:-openrisk}
ports:
- "5434:5432"
volumes:
- openrisk_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-openrisk}"]
interval: 10s
timeout: 5s
retries: 5
networks:
- openrisk_network
restart: unless-stopped
# Test Database (for integration tests)
test_db:
image: postgres:15-alpine
container_name: openrisk_test_db
environment:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: openrisk_test
ports:
- "5435:5432"
volumes:
- openrisk_test_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U test"]
interval: 10s
timeout: 5s
retries: 5
networks:
- openrisk_network
restart: unless-stopped
# =========================================================================
# CACHING & MESSAGING
# =========================================================================
# Redis for caching and session management
redis:
image: redis:7-alpine
container_name: openrisk_redis
ports:
- "6379:6379"
command: redis-server --appendonly yes --requirepass ""
volumes:
- openrisk_redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- openrisk_network
restart: unless-stopped
# =========================================================================
# BACKEND SERVICE (Development Mode)
# =========================================================================
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: openrisk_backend
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
environment:
# Database
DB_HOST: db
DB_PORT: 5432
DB_USER: ${DB_USER:-openrisk}
DB_PASSWORD: ${DB_PASSWORD:-openrisk}
DB_NAME: ${DB_NAME:-openrisk}
# Server
PORT: ${PORT:-8080}
JWT_SECRET: ${JWT_SECRET:-your-secret-key-change-in-production}
# CORS
CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost:5173,http://localhost:3000}
# Redis
REDIS_URL: redis://redis:6379/0
# Environment
APP_ENV: ${APP_ENV:-development}
ports:
- "8080:8080"
networks:
- openrisk_network
restart: unless-stopped
# For development, you can override the CMD with:
# command: go run ./cmd/server
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/api/v1/health"]
interval: 10s
timeout: 5s
retries: 5
# =========================================================================
# FRONTEND SERVICE (Development Mode)
# =========================================================================
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: openrisk_frontend
depends_on:
- backend
environment:
# API Configuration
VITE_API_URL: ${VITE_API_URL:-http://localhost:8080/api}
# Build
NODE_ENV: ${NODE_ENV:-development}
ports:
- "5173:5173"
networks:
- openrisk_network
restart: unless-stopped
# For hot-reload during development:
# command: npm run dev -- --host 0.0.0.0
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5173"]
interval: 10s
timeout: 5s
retries: 5
volumes:
openrisk_data:
openrisk_test_data:
openrisk_redis_data:
networks:
openrisk_network:
driver: bridge