From 31353fd9f51d423e7e8fb5094085c3453e387a85 Mon Sep 17 00:00:00 2001 From: mazemaze Date: Fri, 19 Dec 2025 06:38:38 +0900 Subject: [PATCH] Add Dockerfile and standalone output for Eureka deployment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add Dockerfile for Next.js + Prisma (node:20-alpine3.18) - Configure standalone output in next.config.ts - Add .dockerignore to exclude unnecessary files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .dockerignore | 16 ++++++++++++++++ Dockerfile | 37 +++++++++++++++++++++++++++++++++++++ next.config.ts | 2 +- 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..382a6d6 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,16 @@ +node_modules +.git +.gitignore +*.md +.env* +.next +dist +build +coverage +.nyc_output +*.log +.DS_Store +Thumbs.db +.claude +.workflow +.eureka-active-session diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ce8667f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,37 @@ +FROM node:20-alpine3.18 AS base + +FROM base AS deps +RUN apk add --no-cache libc6-compat openssl1.1-compat +WORKDIR /app +COPY package.json package-lock.json* ./ +COPY prisma ./prisma/ +RUN npm ci +ENV DATABASE_URL="file:./placeholder.db" +RUN npx prisma generate + +FROM base AS builder +RUN apk add --no-cache openssl1.1-compat +WORKDIR /app +COPY --from=deps /app/node_modules ./node_modules +COPY . . +ENV DATABASE_URL="file:./placeholder.db" +RUN npx prisma generate +ENV NEXT_TELEMETRY_DISABLED=1 +RUN npm run build + +FROM base AS runner +RUN apk add --no-cache openssl1.1-compat +WORKDIR /app +ENV NODE_ENV=production +RUN addgroup --system --gid 1001 nodejs +RUN adduser --system --uid 1001 nextjs +COPY --from=builder /app/public ./public +COPY --from=builder /app/.next/standalone ./ +COPY --from=builder /app/.next/static ./.next/static +COPY --from=builder /app/prisma ./prisma +COPY --from=builder /app/node_modules/.prisma ./node_modules/.prisma +COPY --from=builder /app/node_modules/@prisma ./node_modules/@prisma +USER nextjs +EXPOSE 3000 +ENV PORT=3000 HOSTNAME="0.0.0.0" +CMD ["node", "server.js"] diff --git a/next.config.ts b/next.config.ts index e9ffa30..225e495 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,7 +1,7 @@ import type { NextConfig } from "next"; const nextConfig: NextConfig = { - /* config options here */ + output: 'standalone', }; export default nextConfig;