feat(deploy): Next standalone 출력 + Dockerfile (NAS self-host Phase 3)
- next.config: output 'standalone' + outputFileTracingRoot(workspace 중첩 방지) - Dockerfile(멀티스테이지, NEXT_PUBLIC_* build-arg) + .dockerignore - maxDuration은 Vercel 운영 보호 위해 유지(self-host에선 무시됨) - 로컬 빌드 검증: .next/standalone/server.js 루트 생성 확인 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
10
.dockerignore
Normal file
10
.dockerignore
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
node_modules
|
||||||
|
.next
|
||||||
|
.git
|
||||||
|
.env*
|
||||||
|
docs
|
||||||
|
supabase
|
||||||
|
*.md
|
||||||
|
.vercel
|
||||||
|
.DS_Store
|
||||||
|
npm-debug.log*
|
||||||
28
Dockerfile
Normal file
28
Dockerfile
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# 쟁승메이드 Next.js — NAS self-host용 standalone 컨테이너
|
||||||
|
# 빌드는 로컬에서(NAS Celeron 빌드 금지). NEXT_PUBLIC_* 는 빌드타임 인라인이라 build-arg로 주입.
|
||||||
|
FROM node:20-alpine AS deps
|
||||||
|
WORKDIR /app
|
||||||
|
COPY package.json package-lock.json ./
|
||||||
|
RUN npm ci
|
||||||
|
|
||||||
|
FROM node:20-alpine AS builder
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
|
COPY . .
|
||||||
|
ARG NEXT_PUBLIC_SUPABASE_URL
|
||||||
|
ARG NEXT_PUBLIC_SUPABASE_ANON_KEY
|
||||||
|
ENV NEXT_PUBLIC_SUPABASE_URL=$NEXT_PUBLIC_SUPABASE_URL
|
||||||
|
ENV NEXT_PUBLIC_SUPABASE_ANON_KEY=$NEXT_PUBLIC_SUPABASE_ANON_KEY
|
||||||
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
FROM node:20-alpine AS runner
|
||||||
|
WORKDIR /app
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
# next.config output:'standalone' 산출물
|
||||||
|
COPY --from=builder /app/.next/standalone ./
|
||||||
|
COPY --from=builder /app/.next/static ./.next/static
|
||||||
|
COPY --from=builder /app/public ./public
|
||||||
|
EXPOSE 3000
|
||||||
|
CMD ["node", "server.js"]
|
||||||
@@ -1,6 +1,10 @@
|
|||||||
import type { NextConfig } from "next";
|
import type { NextConfig } from "next";
|
||||||
|
|
||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
|
// self-host(NAS) 배포용 standalone 출력. Vercel은 이 설정을 무시하므로 양쪽 호환.
|
||||||
|
output: 'standalone',
|
||||||
|
// workspace/ 하위 프로젝트라 Next가 상위를 추적 루트로 오인 → standalone 중첩 방지 위해 고정
|
||||||
|
outputFileTracingRoot: process.cwd(),
|
||||||
async headers() {
|
async headers() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user