Fix Docker build: set PRISMA_SKIP_CONFIG_LOADING and use standalone output
Some checks failed
Build and Publish Mana Loop Docker Image / build-and-publish (push) Failing after 1m38s

This commit is contained in:
2026-03-25 17:51:09 +00:00
parent 5e9f560f26
commit 81a72a1ed7

View File

@@ -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