-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
157 lines (146 loc) · 3.9 KB
/
docker-compose.yml
File metadata and controls
157 lines (146 loc) · 3.9 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
services:
# PostgreSQL Database
postgres:
image: postgres:15-alpine
container_name: emuready-postgres
environment:
POSTGRES_DB: emuready_dev
POSTGRES_USER: emuready
POSTGRES_PASSWORD: emuready_dev_password
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U emuready -d emuready_dev"]
interval: 5s
timeout: 5s
retries: 5
networks:
- emuready-network
# Main Next.js Application
app:
build:
context: .
target: dev
container_name: emuready-app
ports:
- "3000:3000"
environment:
# Docker identifier
DOCKER_CONTAINER: "true"
# Database
DATABASE_URL: "postgresql://emuready:emuready_dev_password@postgres:5432/emuready_dev"
DATABASE_DIRECT_URL: "postgresql://emuready:emuready_dev_password@postgres:5432/emuready_dev"
# Node Environment
NODE_ENV: development
# External URLs (will be overridden by .env.docker)
NEXT_PUBLIC_APP_URL: "http://localhost:3000"
# Clerk Configuration (loaded from .env.docker)
# External APIs (placeholder - will be overridden by .env.docker)
RAWG_API_KEY: ""
THE_GAMES_DB_API_KEY: ""
volumes:
# Source code for hot reload
- .:/app
- /app/node_modules
# Persistent uploads
- uploads_data:/app/public/uploads
# Flag file to track if initial setup has been done
- setup_data:/app/.setup
depends_on:
postgres:
condition: service_healthy
networks:
- emuready-network
env_file:
- .env.docker
command: >
sh -c "
echo 'Waiting for database...' &&
npx prisma migrate deploy &&
if [ ! -f .setup/seeded ]; then
echo 'Running initial database seed...' &&
npx prisma db seed &&
mkdir -p .setup &&
touch .setup/seeded &&
echo 'Initial setup completed';
else
echo 'Database already seeded, skipping seed step';
fi &&
npm run dev
"
# Prisma Studio - Database Admin Interface
prisma-studio:
build:
context: .
target: dev
container_name: emuready-prisma-studio
ports:
- "5555:5555"
environment:
# Database
DATABASE_URL: "postgresql://emuready:emuready_dev_password@postgres:5432/emuready_dev"
DATABASE_DIRECT_URL: "postgresql://emuready:emuready_dev_password@postgres:5432/emuready_dev"
volumes:
# Source code for schema access
- .:/app
- /app/node_modules
depends_on:
postgres:
condition: service_healthy
app:
condition: service_started
networks:
- emuready-network
env_file:
- .env.docker
command: >
sh -c "
echo 'Starting Prisma Studio...' &&
npx prisma studio --hostname 0.0.0.0 --port 5555
"
# Cloudflared Tunnel for Clerk Webhooks
cloudflared:
image: cloudflare/cloudflared:latest
container_name: emuready-tunnel
restart: unless-stopped
command: tunnel run emuready-tunnel
env_file:
- .env.docker
depends_on:
- app
networks:
- emuready-network
profiles:
- webhooks # Optional service, only run when needed
# pgAdmin for Database Management (Optional)
pgadmin:
image: dpage/pgadmin4:latest
container_name: emuready-pgadmin
environment:
PGADMIN_DEFAULT_EMAIL: admin@emuready.dev
PGADMIN_DEFAULT_PASSWORD: admin
PGADMIN_CONFIG_SERVER_MODE: "False"
ports:
- "5050:80"
depends_on:
- postgres
networks:
- emuready-network
profiles:
- tools # Optional service
volumes:
- pgadmin_data:/var/lib/pgadmin
volumes:
postgres_data:
driver: local
uploads_data:
driver: local
pgadmin_data:
driver: local
setup_data:
driver: local
networks:
emuready-network:
driver: bridge