Fase 0: scaffold monorepo, SvelteKit skeleton, and dev infrastructure
- Turborepo + pnpm workspaces with apps/web and packages/types - SvelteKit app: Tailwind, Paraglide i18n (en/es), keycloak-js, Supabase client, auth/collective stores, PWA service worker skeleton, all route placeholders - packages/types: domain types (User, Collective, ShoppingList, etc.) and database.ts placeholder for generated types - Justfile with dev, db-*, kc-*, build, backup, restore, deploy recipes - infra/docker-compose.dev.yml: Postgres 15, GoTrue, PostgREST, Realtime v2.83, Storage, Kong (port 8001), Studio, Keycloak 24 - infra/docker-compose.prod.yml, kong.yml, db-init scripts, backup/deploy scripts - keycloak/realm-export.json with colectivo realm and 5 dev test users - supabase/config.toml and seed.sql with sample collective and items - GitHub Actions: ci.yml (lint+typecheck+build) and deploy.yml (GHCR + SSH) - .env.example documenting all required variables - Fixed docker-compose issues: Studio image tag, Kong port conflict (8001), internal role passwords init script, Realtime METRICS_JWT_SECRET/APP_NAME Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
55
apps/web/Dockerfile
Normal file
55
apps/web/Dockerfile
Normal file
@@ -0,0 +1,55 @@
|
||||
# Multi-stage build for the SvelteKit Node.js server
|
||||
# Build args map to PUBLIC_* env vars baked at build time (SvelteKit requires this)
|
||||
|
||||
FROM node:22-alpine AS base
|
||||
RUN corepack enable pnpm
|
||||
|
||||
# ── Dependencies ──────────────────────────────────────────────────────────────
|
||||
FROM base AS deps
|
||||
WORKDIR /app
|
||||
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
|
||||
COPY apps/web/package.json ./apps/web/
|
||||
COPY packages/types/package.json ./packages/types/
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# ── Build ─────────────────────────────────────────────────────────────────────
|
||||
FROM base AS builder
|
||||
WORKDIR /app
|
||||
|
||||
ARG PUBLIC_SUPABASE_URL
|
||||
ARG PUBLIC_SUPABASE_ANON_KEY
|
||||
ARG PUBLIC_KEYCLOAK_URL
|
||||
ARG PUBLIC_KEYCLOAK_REALM
|
||||
ARG PUBLIC_KEYCLOAK_CLIENT_ID
|
||||
ARG PUBLIC_APP_URL
|
||||
|
||||
ENV PUBLIC_SUPABASE_URL=$PUBLIC_SUPABASE_URL
|
||||
ENV PUBLIC_SUPABASE_ANON_KEY=$PUBLIC_SUPABASE_ANON_KEY
|
||||
ENV PUBLIC_KEYCLOAK_URL=$PUBLIC_KEYCLOAK_URL
|
||||
ENV PUBLIC_KEYCLOAK_REALM=$PUBLIC_KEYCLOAK_REALM
|
||||
ENV PUBLIC_KEYCLOAK_CLIENT_ID=$PUBLIC_KEYCLOAK_CLIENT_ID
|
||||
ENV PUBLIC_APP_URL=$PUBLIC_APP_URL
|
||||
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY --from=deps /app/apps/web/node_modules ./apps/web/node_modules
|
||||
COPY . .
|
||||
|
||||
RUN pnpm --filter @colectivo/types build 2>/dev/null || true
|
||||
RUN pnpm --filter @colectivo/web build
|
||||
|
||||
# ── Runtime ───────────────────────────────────────────────────────────────────
|
||||
FROM node:22-alpine AS runner
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
|
||||
# Only copy the compiled output
|
||||
COPY --from=builder /app/apps/web/build ./build
|
||||
COPY --from=builder /app/apps/web/package.json ./
|
||||
|
||||
# Install production-only deps for the Node adapter
|
||||
RUN npm install --omit=dev --ignore-scripts 2>/dev/null || true
|
||||
|
||||
EXPOSE 3000
|
||||
CMD ["node", "build"]
|
||||
Reference in New Issue
Block a user