From 81a72a1ed72cfa1c43431332e36b793ca6b3990b Mon Sep 17 00:00:00 2001 From: zhipu Date: Wed, 25 Mar 2026 17:51:09 +0000 Subject: [PATCH] Fix Docker build: set PRISMA_SKIP_CONFIG_LOADING and use standalone output --- Dockerfile | 46 +++++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/Dockerfile b/Dockerfile index 98609d6..a56f7b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,49 +1,37 @@ # Mana Loop - Next.js Game Docker Image -# Multi-stage build for optimized production image -# Stage 1: Dependencies -FROM node:20-alpine AS deps -WORKDIR /app - -# Install dependencies for native modules -RUN apk add --no-cache libc6-compat openssl - -# Copy package files -COPY package.json bun.lockb* ./ -COPY prisma ./prisma/ - -# Install bun for faster installs -RUN npm install -g bun - -# Install dependencies (including devDependencies for build) -RUN bun install --frozen-lockfile - -# Stage 2: Builder FROM node:20-alpine AS builder WORKDIR /app -# Install openssl for Prisma -RUN apk add --no-cache openssl +# Install dependencies +RUN apk add --no-cache libc6-compat openssl -# Copy dependencies from deps stage -COPY --from=deps /app/node_modules ./node_modules -COPY . . - -# Install bun for build +# Install bun RUN npm install -g bun +# Copy package files first for better caching +COPY package.json bun.lockb* ./ +COPY prisma ./prisma/ + +# Install dependencies +RUN bun install --frozen-lockfile + +# Copy the rest of the application +COPY . . + # Set environment variables for build ENV NEXT_TELEMETRY_DISABLED=1 ENV NODE_ENV=production ENV DATABASE_URL="file:./dev.db" +ENV PRISMA_SKIP_CONFIG_LOADING=1 -# Generate Prisma client using npx (more reliable in Docker) -RUN npx prisma generate --schema=./prisma/schema.prisma +# Generate Prisma client +RUN bunx prisma generate --schema=./prisma/schema.prisma # Build the application RUN bun run build -# Stage 3: Runner +# Production image FROM node:20-alpine AS runner WORKDIR /app