learning_ai_notes/web/Dockerfile
saravanakumardb1 cbbd9ddce9 fix(docker): upgrade Dockerfiles to node:22-slim + add NODE_TLS + fix next.config.ts
- backend/Dockerfile: alpine→slim, add NODE_TLS_REJECT_UNAUTHORIZED=0, 3-stage pattern
- web/Dockerfile: alpine→slim, add NODE_TLS_REJECT_UNAUTHORIZED=0, remove non-existent public/ COPY
- web/next.config.ts: add transpilePackages + webpack symlinks for pnpm @bytelyst/* resolution

Docker smoke tests: backend + web builds pass
2026-03-22 21:06:07 -07:00

33 lines
1.1 KiB
Docker

# Pre-requisite: run ./scripts/docker-prep.sh to pack @bytelyst/* tarballs
# ── Stage 1: Install ──────────────────────────────────
FROM node:22-slim AS builder
WORKDIR /app/web
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
RUN npm config set strict-ssl false
COPY web/package.json ./package.json
COPY web/.docker-deps/ ./.docker-deps/
RUN npm install --legacy-peer-deps
COPY web/ ./
COPY shared/ ../shared/
# Dummy env vars for Next.js build-time page data collection
ENV NEXT_PUBLIC_BACKEND_URL=http://localhost:4016
ENV NEXT_PUBLIC_PLATFORM_URL=http://localhost:4003
ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
RUN npm run build
# ── Stage 2: Runtime ──────────────────────────────────
FROM node:22-slim
WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
COPY --from=builder /app/web/.next/standalone ./
COPY --from=builder /app/web/.next/static ./.next/static
EXPOSE 3000
CMD ["node", "server.js"]