Fix: Use Node for runtime to fix binary buffer bug

This commit is contained in:
2026-03-14 18:24:10 -07:00
parent d1c3a65fa0
commit 4b443e1d89

View File

@@ -1,31 +1,29 @@
FROM oven/bun:alpine AS base
# Install dependencies only when needed
FROM base AS deps
# Stage 1: Fast dependencies using Bun
FROM oven/bun:alpine AS deps
WORKDIR /app
# Copy package files (Bun can install from package.json just fine)
COPY package.json package-lock.json* ./
RUN bun install
# Rebuild the source code only when needed
FROM base AS builder
# Stage 2: Fast builds using Bun
FROM oven/bun:alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN bun run build
# Production image, copy all the files and run next
FROM base AS runner
# Stage 3: Stable production runtime using Node.js
FROM node:18-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=3004
# Next.js standalone requires libc6-compat on alpine
RUN apk add --no-cache libc6-compat
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=builder /app/public ./public
# Next.js standalone output works perfectly via Bun
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
@@ -33,5 +31,6 @@ USER nextjs
EXPOSE 3004
# Run the Next.js standalone server using Bun instead of Node
CMD ["bun", "server.js"]
# Run the Next.js server stably with Node
CMD ["node", "server.js"]