sentry-cli (Rust binary) failed the sourcemap upload with "unable to get local issuer certificate" when talking to GlitchTip over TLS -- the node:22-alpine builder image ships without a CA bundle. Confirmed via verbose build log after the SENTRY_RELEASE fix resolved the prior --release undefined failure.
75 lines
2.8 KiB
Docker
75 lines
2.8 KiB
Docker
# ──────────────────────────────────────────────
|
|
# Stage 1: install dependencies
|
|
# ──────────────────────────────────────────────
|
|
FROM node:22-alpine AS deps
|
|
RUN apk add --no-cache libc6-compat
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
|
|
# ──────────────────────────────────────────────
|
|
# Stage 2: build
|
|
# ──────────────────────────────────────────────
|
|
FROM node:22-alpine AS builder
|
|
WORKDIR /app
|
|
|
|
# sentry-cli (invoked by withSentryConfig during `npm run build` to upload
|
|
# source maps) is a Rust binary that needs the system CA bundle to validate
|
|
# GlitchTip's TLS cert — Alpine ships without one, causing "unable to get
|
|
# local issuer certificate" and a failed upload.
|
|
RUN apk add --no-cache ca-certificates
|
|
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
|
|
# NEXT_PUBLIC_* vars are baked into the client bundle at build time.
|
|
# All other server-side secrets are injected at runtime via docker-compose
|
|
# env_file — except the three below, which withSentryConfig (next.config.ts)
|
|
# needs during `npm run build` itself to upload source maps. They never reach
|
|
# the final runner stage (discarded with this builder stage), so they don't
|
|
# leak into the shipped image's runtime environment.
|
|
ARG NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
|
|
ARG NEXT_PUBLIC_SUPABASE_URL
|
|
ARG NEXT_PUBLIC_SENTRY_DSN
|
|
ARG SENTRY_ORG
|
|
ARG SENTRY_PROJECT
|
|
ARG SENTRY_AUTH_TOKEN
|
|
ARG SENTRY_RELEASE
|
|
|
|
ENV NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=$NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
|
|
ENV NEXT_PUBLIC_SUPABASE_URL=$NEXT_PUBLIC_SUPABASE_URL
|
|
ENV NEXT_PUBLIC_SENTRY_DSN=$NEXT_PUBLIC_SENTRY_DSN
|
|
ENV SENTRY_ORG=$SENTRY_ORG
|
|
ENV SENTRY_PROJECT=$SENTRY_PROJECT
|
|
ENV SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN
|
|
ENV SENTRY_RELEASE=$SENTRY_RELEASE
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
|
|
RUN npx prisma generate
|
|
RUN npm run build
|
|
|
|
# ──────────────────────────────────────────────
|
|
# Stage 3: production image (minimal)
|
|
# ──────────────────────────────────────────────
|
|
FROM node:22-alpine AS runner
|
|
WORKDIR /app
|
|
|
|
ENV NODE_ENV=production
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
|
|
RUN addgroup --system --gid 1001 nodejs \
|
|
&& 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 3000
|
|
ENV PORT=3000
|
|
ENV HOSTNAME="0.0.0.0"
|
|
|
|
CMD ["node", "server.js"]
|