-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
77 lines (67 loc) · 1.79 KB
/
docker-compose.yml
File metadata and controls
77 lines (67 loc) · 1.79 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
services:
# 1. PERSISTENTE POSTGRESQL DATENBANK
db:
image: postgres:15-alpine
container_name: postgres_db
restart: unless-stopped
# Speichert die DB-Daten persistent im 'postgres_data' Volume
volumes:
- postgres_data:/var/lib/postgresql/data/
# Lädt alle DB-Zugangsdaten aus der .env-Datei
env_file:
- .env
ports:
- "5432:5432"
networks:
- webnet
# 2. DJANGO BACKEND SERVICE (API)
api:
build:
context: ./backend
dockerfile: Dockerfile
container_name: django_api
# Bind Mount für Code-Änderungen in der Entwicklung (Live-Sync)
volumes:
- ./backend:/app
# 🔒 SICHERHEIT: Der Port ist nur INTERN für andere Container erreichbar.
# Externe Zugriffe (z.B. über localhost:8000) werden blockiert.
# expose:
# - "8000" (FOR DEVELOPMENT, we will expose this port so Swagger can be accessed)
ports:
- "8000:8000"
env_file:
- .env
depends_on:
- db
networks:
- webnet
# 3. NEXT.JS FRONTEND SERVICE (SSR/Proxy)
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: frontend
# 💡 ENTWICKLUNG: Entferne die Kommentare für Live Reload
# volumes:
# - ./frontend:/app
# - /app/node_modules
# command: npm run dev
# Exponiert den Frontend-Port auf den Host-Rechner
ports:
- "3000:3000"
env_file:
- .env
environment:
# Interne URL für SSR/Proxy-Aufrufe vom Next.js Server zu Django
DJANGO_INTERNAL_HOST: http://api:8000
depends_on:
- api
networks:
- webnet
# Definition der Volumes (für Persistenz) und Netzwerke
volumes:
postgres_data:
driver: local
networks:
webnet:
driver: bridge