sharp 0.35.5 requires Node >=20.9.0, so the node:18-alpine image failed to load the linuxmusl-arm64 binary and the production build broke. Move the image and both CI workflows to Node 24 (current Active LTS), raise the engines floor to the version sharp actually needs, and declare packageManager to silence the corepack warning. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
47 lines
883 B
Docker
47 lines
883 B
Docker
FROM node:24-alpine AS base
|
|
|
|
RUN apk add --no-cache libc6-compat
|
|
RUN corepack enable && corepack prepare [email protected] --activate
|
|
|
|
WORKDIR /app
|
|
|
|
FROM base AS deps
|
|
|
|
COPY package.json pnpm-lock.yaml ./
|
|
RUN pnpm install --frozen-lockfile --prod=false
|
|
|
|
FROM base AS builder
|
|
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
ENV NODE_ENV=production
|
|
|
|
RUN pnpm run build
|
|
|
|
FROM base AS runner
|
|
|
|
ENV NODE_ENV=production
|
|
ENV NEXT_TELEMETRY_DISABLED=1
|
|
|
|
RUN addgroup --system --gid 1001 nodejs
|
|
RUN adduser --system --uid 1001 nextjs
|
|
|
|
COPY --from=builder /app/public ./public
|
|
|
|
RUN mkdir .next
|
|
RUN chown nextjs:nodejs .next
|
|
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
|
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
|
|
|
USER nextjs
|
|
|
|
EXPOSE 4000
|
|
|
|
ENV PORT=4000
|
|
ENV HOSTNAME="0.0.0.0"
|
|
|
|
CMD ["node", "server.js"]
|