chore: update Dockerfile to set npm log level to error and streamline dependency copying for Prisma

This commit is contained in:
2026-01-21 02:36:44 +02:00
parent 88f86167b4
commit b0ab139ef6

View File

@@ -16,6 +16,7 @@ WORKDIR /app
ENV NPM_CONFIG_FUND=false ENV NPM_CONFIG_FUND=false
ENV NPM_CONFIG_AUDIT=false ENV NPM_CONFIG_AUDIT=false
ENV NPM_CONFIG_UPDATE_NOTIFIER=false ENV NPM_CONFIG_UPDATE_NOTIFIER=false
ENV NPM_CONFIG_LOGLEVEL=error
# Native deps (if you have any native modules) # Native deps (if you have any native modules)
# vips-dev is required for building sharp native binaries # vips-dev is required for building sharp native binaries
@@ -36,7 +37,7 @@ RUN npm install -g node-gyp node-addon-api
# SHARP_IGNORE_GLOBAL_LIBVIPS=1 tells sharp to use the system libvips we installed # SHARP_IGNORE_GLOBAL_LIBVIPS=1 tells sharp to use the system libvips we installed
ENV SHARP_IGNORE_GLOBAL_LIBVIPS=1 ENV SHARP_IGNORE_GLOBAL_LIBVIPS=1
RUN echo "📥 Installing npm dependencies..." && \ RUN echo "📥 Installing npm dependencies..." && \
npm ci --omit=dev --no-audit --no-fund npm ci --omit=dev --no-audit --no-fund --loglevel=error
############################ ############################
@@ -91,17 +92,14 @@ COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./ COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static COPY --from=builder /app/.next/static ./.next/static
# If you use Prisma at runtime, you need schema + engines # Prisma migrations at startup require Prisma CLI + its full dependency tree.
# Copy the complete production node_modules (avoid chasing missing transitive deps).
# NOTE: this intentionally overwrites the minimal standalone node_modules.
COPY --from=deps /app/node_modules ./node_modules
# Prisma schema + migrations
COPY --from=builder /app/prisma ./prisma COPY --from=builder /app/prisma ./prisma
COPY --from=builder /app/prisma.config.ts ./prisma.config.ts COPY --from=builder /app/prisma.config.ts ./prisma.config.ts
COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma
COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma
COPY --from=builder /app/node_modules/prisma ./node_modules/prisma
COPY --from=builder /app/node_modules/.bin ./node_modules/.bin
COPY --from=builder /app/node_modules/valibot ./node_modules/valibot
# Copy sharp binaries (required for Next.js image optimization)
COPY --from=builder /app/node_modules/sharp ./node_modules/sharp
# Add runtime env check entrypoint (no secrets baked) # Add runtime env check entrypoint (no secrets baked)
COPY docker/entrypoint.sh /app/entrypoint.sh COPY docker/entrypoint.sh /app/entrypoint.sh