From 3d5111bbf3185a855ba2b2fcc2427cc313ef7885 Mon Sep 17 00:00:00 2001 From: Daniel Schulteis Date: Fri, 23 Jan 2026 00:37:15 +0100 Subject: [PATCH] Add production Dockerfile and standalone config --- Dockerfile | 27 +++++++++++++++++++++++++++ next.config.ts | 1 + 2 files changed, 28 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..61a907a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +# Stage 1: Install dependencies +FROM node:20-alpine AS deps +WORKDIR /app +COPY package.json package-lock.json ./ +RUN npm ci + +# Stage 2: Build the app +FROM node:20-alpine AS builder +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . +RUN npm run build + +# Stage 3: Runner +FROM node:20-alpine AS runner +WORKDIR /app +ENV NODE_ENV=production + +# Copy necessary files from builder +COPY --from=builder /app/public ./public +COPY --from=builder /app/.next/standalone ./ +COPY --from=builder /app/.next/static ./.next/static + +EXPOSE 3000 +ENV PORT=3000 + +CMD ["node", "server.js"] \ No newline at end of file diff --git a/next.config.ts b/next.config.ts index e9ffa30..ad52782 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,6 +1,7 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { + output: "standalone", /* config options here */ };