Files
Convivo/apps/convivo/Dockerfile
T
Lago 37684ba116 Phase 0 + 1: Dockerized Supabase core + attendee PWA
Phase 0 — Supabase core (Docker via CLI):
- Schema: profiles, slots, sessions, preferences, connections, checkins,
  feedback, leaderboard (Realtime mirror), points_log
- RLS on every table; transactional security-definer points RPCs
- Seed: 6 slots, 18 sessions, 13 demo users (QR token as auth password)

Phase 1 — Attendee web PWA (React + Vite + TS):
- Login via QR token + email (GoTrue, no email sent)
- Home, Agenda, Scan/Connect, staff Check-in, Feedback, live Leaderboard, Profile
- Same-origin proxy to Supabase (Vite dev / nginx in Docker)
- Docker: multi-stage build -> nginx sidecar on the Supabase network
2026-08-22 16:10:59 +02:00

36 lines
1.6 KiB
Docker

# Convivo attendee app — multi-stage build.
#
# Stage 1 (build): compile the Vite/React/TS app into static assets.
# Stage 2 (serve): nginx serves the static build and proxies the Supabase
# same-origin paths (/auth, /rest, /realtime, /storage) to the Supabase core.
#
# The Supabase core itself is NOT built here — it runs via the Supabase CLI
# (`supabase start`) or as a separate container. See the root docker-compose.yml.
# ---- Build stage -------------------------------------------------------------
FROM node:20-alpine AS build
WORKDIR /app
# Install deps first for better layer caching (reproducible via lock file).
COPY package.json package-lock.json ./
RUN npm ci
# Copy sources and build. The anon key is baked in at build time (it is not a
# secret — it is the standard local Supabase anon key). Override with
# --build-arg VITE_SUPABASE_ANON_KEY=... if you use a custom key.
ARG VITE_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
ENV VITE_SUPABASE_ANON_KEY=$VITE_SUPABASE_ANON_KEY
COPY . .
RUN npm run build
# ---- Serve stage -------------------------------------------------------------
FROM nginx:1.27-alpine AS serve
# nginx template: serve the SPA + proxy Supabase paths to the core. The proxy
# target is injected at container start (see docker-entrypoint.sh).
COPY nginx.conf.template /etc/nginx/conf.d/default.conf.template
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 3000
ENTRYPOINT ["/docker-entrypoint.sh"]