Files
RAPPORT-SERVER/Dockerfile.app
T
karim 945e46fb03 Initial: Docker-Compose-Stack für Rapport Self-Hosting
Komplettes Bundle für eigene Rapport-Instanz:
- Postgres mit Supabase-Extensions + Init-Script für Standard-Rollen
- GoTrue (Auth) mit konfigurierbarem SMTP für Passwort-Reset-Mails
- PostgREST (REST-API)
- Realtime (Postgres-Changes für Live-Sync)
- Storage-API (Bilder/Quittungen)
- Kong als API-Gateway
- Rapport-Frontend als Multi-Stage-Build (zieht Sources aus dem App-Repo)

Plus:
- scripts/sync-migrations.sh: holt SQL aus dem App-Repo
- .env.example mit allen Pflicht-Secrets + optionalen SMTP-Werten
- nginx.conf mit SPA-Routing
- README mit Setup-Anleitung (Linux + macOS-Colima)
- LICENSE (AGPL-3.0)

Sync mit App-Repo: scripts/sync-migrations.sh holt die Migrations-SQL via
git clone und legt sie nach volumes/db/init/migrations/. Bei jedem
Rapport-Update erneut ausführen.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 20:10:54 +02:00

34 lines
1.4 KiB
Docker

# Multi-Stage Build für das Rapport-Frontend.
# Holt die App-Sources via git, baut sie mit Node, packt das fertige dist/
# in einen schlanken nginx-Container.
#
# Steuerung über Build-Args:
# --build-arg RAPPORT_APP_TAG=0.8.2 Version aus dem App-Repo
# --build-arg SUPABASE_URL=https://... Public-API-URL (kommt in den Build)
# --build-arg SUPABASE_ANON_KEY=... Public Anon-Key (kommt in den Build)
FROM node:20-alpine AS builder
ARG RAPPORT_APP_TAG=main
ARG SUPABASE_URL
ARG SUPABASE_ANON_KEY
ARG REPO_URL=https://git.kgva.ch/karim/RAPPORT.git
RUN apk add --no-cache git
WORKDIR /build
RUN git clone --branch "${RAPPORT_APP_TAG}" --depth 1 "${REPO_URL}" app
WORKDIR /build/app
# .env.production wird zur Build-Zeit ausgewertet → Werte landen im Bundle
RUN if [ -n "$SUPABASE_URL" ]; then \
printf "VITE_SUPABASE_URL=%s\nVITE_SUPABASE_ANON_KEY=%s\n" "$SUPABASE_URL" "$SUPABASE_ANON_KEY" > .env.production; \
fi
RUN npm install --no-audit --no-fund && npm run build
# ──────────────────────────────────────────────────────────
FROM nginx:alpine
COPY --from=builder /build/app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
HEALTHCHECK --interval=30s --timeout=3s CMD wget -q --spider http://localhost/ || exit 1