From da5d5f9ffec81f45a27d2dde7cb61364ad6efb50 Mon Sep 17 00:00:00 2001 From: Todd Date: Sun, 3 May 2026 12:07:17 -0400 Subject: [PATCH] Dockerfile added --- Dockerfile | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..91ce488 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,51 @@ +FROM node:22-alpine AS base + +# Install dependencies only when needed +FROM base AS deps +RUN apk add --no-cache libc6-compat +WORKDIR /app + +# Install dependencies based on the preferred package manager +COPY package.json package-lock.json* ./ +COPY prisma ./prisma +RUN npm ci + +# Rebuild the source code only when needed +FROM base AS builder +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . + +# Next.js telemetry is disabled +ENV NEXT_TELEMETRY_DISABLED 1 + +RUN npm run build + +# Production image, copy all the files and run next +FROM base AS runner +WORKDIR /app + +ENV NODE_ENV production +ENV NEXT_TELEMETRY_DISABLED 1 + +RUN addgroup --system --gid 1001 nodejs +RUN adduser --system --uid 1001 nextjs + +# Copy the standalone output +COPY --from=builder /app/public ./public +COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ +COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static + +# We must copy prisma client manually because standalone Next.js often misses it +COPY --from=builder /app/prisma ./prisma +COPY --from=deps /app/node_modules/.prisma ./node_modules/.prisma +COPY --from=deps /app/node_modules/@prisma ./node_modules/@prisma + +USER nextjs + +EXPOSE 3000 + +ENV PORT 3000 +ENV HOSTNAME "0.0.0.0" + +CMD ["node", "server.js"]