1e23c93aef
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
34 lines
1.4 KiB
Docker
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\nVITE_SERVER_MODE=1\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://127.0.0.1/ || exit 1
|