Fix Docker build and Next.js metadata configuration

- Move themeColor and viewport to separate viewport export in layout.tsx
- Improve Docker build process with npm ci and proper dependency handling
- Add Docker-friendly Next.js configuration settings
- Resolve constructor error and metadata warnings
This commit is contained in:
2025-12-02 13:47:40 +00:00
parent ff16860d8a
commit c0358d79d7
3 changed files with 25 additions and 15 deletions

View File

@@ -8,21 +8,26 @@ WORKDIR /app
# Copy package files
COPY package.json package-lock.json* ./
# Install dependencies but skip Prisma postinstall
RUN npm install --ignore-scripts
# Clean install dependencies
RUN npm ci --only=production --ignore-scripts && npm cache clean --force
# Rebuild the source code only when needed
FROM base AS builder
RUN apt-get update && apt-get install -y openssl ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
# Copy package files and install all dependencies (including dev)
COPY package.json package-lock.json* ./
RUN npm ci --ignore-scripts
# Copy source code
COPY . .
# Generate Prisma Client for the correct platform (Debian)
RUN npx prisma generate --generator client
# Generate Prisma Client for the correct platform
RUN npx prisma generate
# Build Next.js application
ENV NEXT_TELEMETRY_DISABLED 1
ENV NEXT_TELEMETRY_DISABLED=1
ENV AUTH_TRUST_HOST=true
RUN npm run build