Files
faunosteo/Dockerfile
T
bchanot d239374d81 feat(app): optional Supabase connection in runtime config + lazy typed client
- env.ts: supabase: SupabaseConnection | null resolved from env.js
  (supabaseUrl/supabaseAnonKey), VITE_SUPABASE_*, else null; half config refused
- lib/supabase.ts: getSupabaseClient() null when unconfigured, one client per URL
- entrypoint.sh writes the two public values; .env.example placeholders
- Dockerfile copies packages/supabase manifest for the install layer
- no UI change; 7 new tests (278 app)
2026-10-08 22:43:18 +02:00

45 lines
1.5 KiB
Docker

# ---- stage 1: builder -----------------------------------------------
# Node 24 LTS (Node 20 reached end-of-life on 2026-04-30). pnpm pinned to the
# same version as package.json "packageManager"; pnpm 11 needs Node >= 22.13
# and rewrites the lockfile, so the 10.x line stays pinned on purpose.
FROM node:24-alpine AS builder
WORKDIR /app
RUN corepack enable && corepack prepare pnpm@10.13.1 --activate
# Workspace manifests first for layer caching (install depends only on these)
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
COPY apps/app/package.json apps/app/
COPY packages/supabase/package.json packages/supabase/
RUN pnpm install --frozen-lockfile
# Copy source and build the private app only
COPY . .
RUN pnpm --filter @faunosteo/app build
# ---- stage 2: runner ------------------------------------------------
FROM nginx:1.31-alpine AS runner
# Copy built static assets
COPY --from=builder /app/apps/app/dist /usr/share/nginx/html
# Copy custom nginx config and entrypoint
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
COPY docker/entrypoint.sh /entrypoint.sh
# Run fully as non-root (port 8080 is unprivileged). nginx needs to own:
# its runtime dirs, the config it rewrites at startup (PORT envsubst),
# and the html dir (entrypoint writes env.js there).
RUN chmod +x /entrypoint.sh \
&& touch /var/run/nginx.pid \
&& chown -R nginx:nginx /var/cache/nginx /var/run/nginx.pid \
/etc/nginx/conf.d /usr/share/nginx/html
USER nginx
EXPOSE 8080
ENTRYPOINT ["/entrypoint.sh"]