Ohne explizite Angabe leitet Compose den Projektnamen aus dem Ordnernamen ab und wirft dabei das "ß" ersatzlos weg (Images/ Container hießen "speiekarte-*"). name+image+container_name fixieren das auf "speisekarte-app"/"speisekarte-db"/"speisekarte-dev".
76 lines
2.5 KiB
YAML
76 lines
2.5 KiB
YAML
# =============================================================
|
||
# Speisekarte – Docker-Setup
|
||
#
|
||
# Produktion (App + lokale PostgreSQL-Kopie):
|
||
# docker compose --env-file .env.local up -d --build
|
||
#
|
||
# Entwicklung (Dev-Server mit Hot-Reload, kein lokales Node nötig):
|
||
# docker compose --env-file .env.local --profile dev up dev
|
||
#
|
||
# Die --env-file-Angabe speist NEXT_PUBLIC_* in den Build und
|
||
# SUPABASE_SERVICE_ROLE_KEY in die Laufzeit-Umgebung.
|
||
#
|
||
# "name" fixiert den Compose-Projektnamen explizit auf "speisekarte" –
|
||
# ohne diese Angabe leitet Compose ihn aus dem Ordnernamen ab und wirft
|
||
# dabei nicht-alphanumerische Zeichen (das "ß" in "Speißekarte") weg.
|
||
# =============================================================
|
||
|
||
name: speisekarte
|
||
|
||
services:
|
||
# ---------- Next.js-App (Produktions-Build) ----------
|
||
app:
|
||
build:
|
||
context: .
|
||
args:
|
||
NEXT_PUBLIC_SUPABASE_URL: ${NEXT_PUBLIC_SUPABASE_URL}
|
||
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${NEXT_PUBLIC_SUPABASE_ANON_KEY}
|
||
image: speisekarte-app
|
||
container_name: speisekarte-app
|
||
environment:
|
||
NEXT_PUBLIC_SUPABASE_URL: ${NEXT_PUBLIC_SUPABASE_URL}
|
||
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${NEXT_PUBLIC_SUPABASE_ANON_KEY}
|
||
SUPABASE_SERVICE_ROLE_KEY: ${SUPABASE_SERVICE_ROLE_KEY}
|
||
ports:
|
||
- "3000:3000"
|
||
restart: unless-stopped
|
||
|
||
# ---------- Lokale PostgreSQL-Kopie (Ablage/Auswertungen) ----------
|
||
# Beim ersten Start werden die Skripte aus supabase/local
|
||
# automatisch in alphabetischer Reihenfolge eingespielt.
|
||
db:
|
||
image: postgres:17-alpine
|
||
container_name: speisekarte-db
|
||
environment:
|
||
POSTGRES_DB: speisekarte
|
||
POSTGRES_PASSWORD: ${LOCAL_PG_PASSWORD:-speisekarte}
|
||
ports:
|
||
# Host-Port 5433, da 5432 meist schon von einer nativen
|
||
# PostgreSQL-Installation belegt ist.
|
||
- "5433:5432"
|
||
volumes:
|
||
- pgdata:/var/lib/postgresql/data
|
||
- ./supabase/local:/docker-entrypoint-initdb.d:ro
|
||
restart: unless-stopped
|
||
|
||
# ---------- Dev-Server (nur mit --profile dev) ----------
|
||
dev:
|
||
image: node:24-alpine
|
||
container_name: speisekarte-dev
|
||
profiles: ["dev"]
|
||
working_dir: /app
|
||
command: sh -c "npm install && npm run dev"
|
||
environment:
|
||
NEXT_PUBLIC_SUPABASE_URL: ${NEXT_PUBLIC_SUPABASE_URL}
|
||
NEXT_PUBLIC_SUPABASE_ANON_KEY: ${NEXT_PUBLIC_SUPABASE_ANON_KEY}
|
||
SUPABASE_SERVICE_ROLE_KEY: ${SUPABASE_SERVICE_ROLE_KEY}
|
||
ports:
|
||
- "3000:3000"
|
||
volumes:
|
||
- .:/app
|
||
- dev_node_modules:/app/node_modules
|
||
|
||
volumes:
|
||
pgdata:
|
||
dev_node_modules:
|