-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
109 lines (103 loc) · 2.63 KB
/
docker-compose.yml
File metadata and controls
109 lines (103 loc) · 2.63 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
version: '3.8'
services:
# PostgreSQL Database
postgres:
image: postgres:15-alpine
container_name: meshadmin-postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER:-meshadmin}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password123}
POSTGRES_DB: ${POSTGRES_DB:-meshadmin}
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- '5432:5432'
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U ${POSTGRES_USER:-meshadmin}']
interval: 10s
timeout: 5s
retries: 5
networks:
- meshadmin-network
# Redis Cache
redis:
image: redis:7-alpine
container_name: meshadmin-redis
restart: unless-stopped
command: redis-server --appendonly yes --requirepass ${REDIS_PASSWORD}
volumes:
- redis_data:/data
# Port mapping removed for production security
# Uncomment the following lines only for local development:
# ports:
# - '6379:6379'
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
interval: 10s
timeout: 5s
retries: 5
networks:
- meshadmin-network
# Backend API
backend:
build:
context: .
dockerfile: Dockerfile.backend
target: runner
container_name: meshadmin-backend
restart: unless-stopped
environment:
NODE_ENV: production
PORT: 3001
DATABASE_URL: postgresql://${POSTGRES_USER:-meshadmin}:${POSTGRES_PASSWORD:-password123}@postgres:5432/${POSTGRES_DB:-meshadmin}
REDIS_URL: redis://redis:6379
JWT_SECRET: ${JWT_SECRET}
JWT_EXPIRES_IN: ${JWT_EXPIRES_IN:-7d}
CORS_ORIGIN: ${CORS_ORIGIN:-http://localhost}
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
ports:
- '3001:3001'
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:3001/health']
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- meshadmin-network
# Frontend
frontend:
build:
context: .
dockerfile: Dockerfile.frontend
target: runner
args:
VITE_API_URL: ${VITE_API_URL:-http://localhost:3001/api}
container_name: meshadmin-frontend
restart: unless-stopped
depends_on:
backend:
condition: service_healthy
ports:
- '80:80'
- '443:443'
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost/health']
interval: 30s
timeout: 10s
retries: 3
networks:
- meshadmin-network
volumes:
postgres_data:
driver: local
redis_data:
driver: local
networks:
meshadmin-network:
driver: bridge