-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
132 lines (126 loc) · 4.1 KB
/
docker-compose.yml
File metadata and controls
132 lines (126 loc) · 4.1 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
# Glassbox Docker Compose - Development Configuration
# This file is for local development with local builds
#
# Usage:
# docker-compose up -d # Start all services
# docker-compose logs -f # View logs
# docker-compose down # Stop all services
# docker-compose up -d --build # Rebuild and start
services:
# ==========================================================================
# Nginx Reverse Proxy
# ==========================================================================
nginx:
image: nginx:alpine
container_name: glassbox-nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./certs:/etc/nginx/certs:ro
- ./certbot/www:/var/www/certbot:ro
depends_on:
frontend:
condition: service_healthy
backend:
condition: service_healthy
restart: unless-stopped
networks:
- glassbox-network
healthcheck:
test: ["CMD", "nginx", "-t"]
interval: 30s
timeout: 10s
retries: 3
# ==========================================================================
# Next.js Frontend (Local Build)
# ==========================================================================
frontend:
build:
context: .
dockerfile: apps/web/Dockerfile
args:
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL:-http://localhost:4000}
container_name: glassbox-frontend
environment:
- NODE_ENV=production
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL:-http://localhost:4000}
- NEXTAUTH_URL=${NEXTAUTH_URL:-http://localhost:3000}
- NEXTAUTH_SECRET=${NEXTAUTH_SECRET}
- GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
- GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
- AUTH_TRUST_HOST=true
depends_on:
backend:
condition: service_healthy
restart: unless-stopped
networks:
- glassbox-network
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/"]
interval: 30s
timeout: 10s
start_period: 30s
retries: 3
# ==========================================================================
# Nest.js Backend (Local Build)
# ==========================================================================
backend:
build:
context: .
dockerfile: apps/backend/Dockerfile
container_name: glassbox-backend
environment:
- NODE_ENV=production
- PORT=4000
- DATABASE_URL=postgresql://glassbox:${DB_PASSWORD:-glassbox_dev}@postgres:5432/glassbox
- JWT_SECRET=${JWT_SECRET}
- NEXTAUTH_SECRET=${NEXTAUTH_SECRET}
- FRONTEND_URL=${FRONTEND_URL:-http://localhost:3000}
depends_on:
postgres:
condition: service_healthy
restart: unless-stopped
networks:
- glassbox-network
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:4000/"]
interval: 30s
timeout: 10s
start_period: 30s
retries: 3
# ==========================================================================
# PostgreSQL Database
# ==========================================================================
postgres:
image: postgres:16-alpine
container_name: glassbox-postgres
environment:
- POSTGRES_USER=glassbox
- POSTGRES_PASSWORD=${DB_PASSWORD:-glassbox_dev}
- POSTGRES_DB=glassbox
volumes:
- postgres_data:/var/lib/postgresql/data
- ./backups:/backups
restart: unless-stopped
networks:
- glassbox-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U glassbox -d glassbox"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
# ==========================================================================
# Networks
# ==========================================================================
networks:
glassbox-network:
driver: bridge
# ==========================================================================
# Volumes
# ==========================================================================
volumes:
postgres_data:
driver: local