BMS/frontend/Dockerfile
megaproxy d4a104be9d Complete demo-mode auth conversion and fix the frontend build
proxy.ts already declared auth disabled, but layout.tsx still wrapped the
tree in ClerkProvider and topbar.tsx rendered UserButton. @clerk/nextjs v7
aborts `next build` without a real publishable key, so the image could not
be built at all. Remove the remaining Clerk surface, drop the dependency,
and delete the sign-in/sign-up route groups.

Also fix two pnpm failures this exposed: the deps stage never copied
pnpm-workspace.yaml (so the build-script allowlist was invisible), and
pnpm 11 renamed ignoredBuiltDependencies to allowBuilds. Declare both
spellings and pin packageManager so this cannot drift again.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-04 17:42:51 +01:00

38 lines
1 KiB
Docker

FROM node:22-alpine AS base
# Install dependencies only when needed
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
# pnpm-workspace.yaml carries ignoredBuiltDependencies — without it pnpm 10+
# aborts the install with ERR_PNPM_IGNORED_BUILDS.
COPY package.json pnpm-lock.yaml* pnpm-workspace.yaml* ./
RUN corepack enable pnpm && pnpm install --frozen-lockfile
# Build the app
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
ARG BACKEND_INTERNAL_URL=http://backend:8000
ENV BACKEND_INTERNAL_URL=$BACKEND_INTERNAL_URL
RUN corepack enable pnpm && pnpm build
# Production runner
FROM base AS runner
WORKDIR /app
ENV NODE_ENV=production
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 5646
ENV PORT=5646
ENV HOSTNAME="0.0.0.0"
CMD ["node", "server.js"]