-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
174 lines (167 loc) · 5.38 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
174 lines (167 loc) · 5.38 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
version: '3.8'
services:
mongodb:
image: mongo:7.0
container_name: litecoin-mongodb-dev
environment:
# Only set init DB variables if MONGO_ROOT_PASSWORD is set
# MongoDB requires both USERNAME and PASSWORD to be set together
- MONGO_INITDB_ROOT_USERNAME=${MONGO_ROOT_USERNAME:-admin}
- MONGO_INITDB_ROOT_PASSWORD=${MONGO_ROOT_PASSWORD:-}
# Only enable --auth if MONGO_ROOT_PASSWORD is set
# --bind_ip_all allows connections from other containers
# Use entrypoint override to conditionally set/unset init DB vars
entrypoint: >
sh -c "
if [ -n \"$$MONGO_ROOT_PASSWORD\" ]; then
export MONGO_INITDB_ROOT_USERNAME=\"$${MONGO_ROOT_USERNAME:-admin}\";
export MONGO_INITDB_ROOT_PASSWORD=\"$$MONGO_ROOT_PASSWORD\";
else
unset MONGO_INITDB_ROOT_USERNAME;
unset MONGO_INITDB_ROOT_PASSWORD;
fi;
exec docker-entrypoint.sh mongod --bind_ip_all $${MONGO_ROOT_PASSWORD:+--auth}
"
ports:
- "27017:27017"
volumes:
- mongodb_dev_data:/data/db
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "if [ -n \"$$MONGO_ROOT_PASSWORD\" ]; then mongosh --quiet --username $$MONGO_ROOT_USERNAME --password $$MONGO_ROOT_PASSWORD --authenticationDatabase admin --eval \"db.adminCommand('ping')\"; else mongosh --quiet --eval \"db.adminCommand('ping')\"; fi"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: litecoin-backend-dev
ports:
- "8000:8000"
env_file:
- ./.env.docker.dev
- ./backend/.env
environment:
# Development-specific overrides
# Note: GOOGLE_API_KEY is loaded from ./backend/.env via env_file above
- NODE_ENV=development
- ENVIRONMENT=development
# Use Docker service name for Payload CMS (internal port 3000)
# This allows backend to connect to Payload CMS inside Docker network
- PAYLOAD_PUBLIC_SERVER_URL=http://payload_cms:3000
# Redis connection URL using Docker service name
- REDIS_URL=redis://redis:6379/0
depends_on:
mongodb:
condition: service_healthy
redis:
condition: service_healthy
volumes:
# Mount backend code for hot reload
- ./backend:/app/backend
# Mount monitoring data directory
- ./backend/monitoring/data:/app/backend/monitoring/data
# Preserve Python cache in named volume to avoid conflicts
- backend_pycache:/app/backend/__pycache__
command: uvicorn backend.main:app --host 0.0.0.0 --port 8000 --reload --reload-dir /app/backend
restart: unless-stopped
redis:
image: redis:7-alpine
container_name: litecoin-redis-dev
# Only add --requirepass if REDIS_PASSWORD is set
command: >
sh -c "if [ -n \"$$REDIS_PASSWORD\" ]; then
redis-server --requirepass $$REDIS_PASSWORD --save 60 1 --loglevel warning;
else
redis-server --save 60 1 --loglevel warning;
fi"
ports:
- "6379:6379"
volumes:
- redis_dev_data:/data
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
frontend:
build:
context: ./frontend
dockerfile: Dockerfile.dev
container_name: litecoin-frontend-dev
ports:
- "3000:3000"
env_file:
- ./.env.docker.dev
environment:
# Development-specific overrides
- NODE_ENV=development
volumes:
# Mount frontend code for hot reload
- ./frontend:/app
# Use named volume for node_modules to avoid conflicts
- frontend_node_modules:/app/node_modules
command: npm run dev
depends_on:
- backend
restart: unless-stopped
payload_cms:
build:
context: ./payload_cms
dockerfile: Dockerfile.dev
container_name: litecoin-payload-cms-dev
ports:
- "3001:3000"
env_file:
- ./.env.docker.dev
- ./payload_cms/.env
environment:
# Development-specific overrides
# Note: PAYLOAD_SECRET is loaded from ./payload_cms/.env via env_file above
- NODE_ENV=development
depends_on:
mongodb:
condition: service_healthy
backend:
condition: service_started
volumes:
# Mount payload_cms code for hot reload
- ./payload_cms:/app
# Use named volume for node_modules to avoid conflicts
- payload_cms_node_modules:/app/node_modules
command: npx pnpm dev
restart: unless-stopped
admin_frontend:
build:
context: ./admin-frontend
dockerfile: Dockerfile.dev
container_name: litecoin-admin-frontend-dev
ports:
- "3002:3000"
env_file:
- ./.env.docker.dev
environment:
# Development-specific overrides
- NODE_ENV=development
# Use localhost for browser access (backend is exposed on host port 8000)
- NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
volumes:
# Mount admin-frontend code for hot reload
- ./admin-frontend:/app
# Use named volume for node_modules to avoid conflicts
- admin_frontend_node_modules:/app/node_modules
command: npm run dev
depends_on:
- backend
restart: unless-stopped
volumes:
mongodb_dev_data:
backend_pycache:
frontend_node_modules:
payload_cms_node_modules:
admin_frontend_node_modules:
redis_dev_data: