Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
77 lines (72 loc) · 2.08 KB
/
Copy pathdocker-compose.yml
File metadata and controls
77 lines (72 loc) · 2.08 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
# Local-development stack: hot-reload Django + Next.js, dev Postgres.
# DO NOT use this in production — runserver isn't a production server, the
# Postgres password is in plaintext, and ports are exposed on the host.
# For VPS deployments use `docker-compose.prod.yml` (gunicorn + Caddy + HTTPS).
services:
db:
image: postgres:16-alpine
environment:
POSTGRES_DB: ${POSTGRES_DB:-hearthline}
POSTGRES_USER: ${POSTGRES_USER:-hearthline}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-hearthline_dev}
ports:
- "5432:5432"
volumes:
- hearthline_pg:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-hearthline}"]
interval: 5s
timeout: 3s
retries: 10
backend:
build: ./backend
env_file: .env
environment:
POSTGRES_HOST: db
depends_on:
db:
condition: service_healthy
ports:
- "8000:8000"
volumes:
- ./backend:/app
command: >
sh -c "python manage.py migrate --noinput &&
python manage.py runserver 0.0.0.0:8000"
frontend:
build: ./frontend
env_file: .env
environment:
NEXT_PUBLIC_API_URL: http://localhost:8000/api
INTERNAL_API_URL: http://backend:8000/api
ports:
- "3000:3000"
volumes:
- ./frontend:/app
- /app/node_modules
- /app/.next
command: npm run dev
depends_on:
- backend
# Public HTTPS tunnel via Cloudflare (zero-signup, free, ephemeral URL).
# docker compose --profile tunnel up -d tunnel
# The public URL is printed in `docker compose logs tunnel`.
tunnel:
image: cloudflare/cloudflared:latest
profiles: ["tunnel"]
command: tunnel --url http://backend:8000 --no-autoupdate
depends_on:
- backend
# Optional: ngrok (requires NGROK_AUTHTOKEN — sign up at ngrok.com)
ngrok:
image: ngrok/ngrok:latest
profiles: ["ngrok"]
environment:
NGROK_AUTHTOKEN: ${NGROK_AUTHTOKEN:-}
command: http backend:8000 --log=stdout
ports:
- "4040:4040"
depends_on:
- backend
volumes:
hearthline_pg: