-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
71 lines (66 loc) · 1.82 KB
/
docker-compose.yml
File metadata and controls
71 lines (66 loc) · 1.82 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
# ✨ built by nich
# 🌐 GitHub: github.com/nirholas
# 💫 Keep calm and code on 🧘
services:
# Frontend application
frontend:
build:
context: .
dockerfile: Dockerfile
ports:
- "3000:80"
environment:
- NODE_ENV=production
- VITE_API_URL=${VITE_API_URL:?Set VITE_API_URL to your production backend URL}
depends_on:
- backend
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost/"]
interval: 30s
timeout: 3s
retries: 3
start_period: 5s
networks:
- web3-network
# Backend API server (NEW!)
backend:
build:
context: ./server
dockerfile: Dockerfile
ports:
- "3001:3001"
env_file:
- ./server/.env
environment:
- NODE_ENV=production
- PORT=3001
- CORS_ORIGIN=${CORS_ORIGIN:?Set CORS_ORIGIN to your production frontend URL}
restart: unless-stopped
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3001/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"]
interval: 30s
timeout: 3s
retries: 3
start_period: 5s
networks:
- web3-network
# Redis for caching (optional)
redis:
image: redis:7-alpine
# Security: Bind to localhost only and require password
# IMPORTANT: Set REDIS_PASSWORD in your environment — server will not start without it
command: >-
sh -c 'if [ -z "$REDIS_PASSWORD" ]; then echo "ERROR: REDIS_PASSWORD must be set" && exit 1; fi && redis-server --requirepass "$REDIS_PASSWORD" --bind 127.0.0.1'
ports:
- "127.0.0.1:6379:6379"
volumes:
- redis-data:/data
restart: unless-stopped
networks:
- web3-network
volumes:
redis-data:
networks:
web3-network:
driver: bridge