File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Stage 1: build
2+ FROM node:24-alpine AS builder
3+ WORKDIR /app
4+ ENV NODE_ENV=production
5+
6+ # Install dependencies (uses yarn if yarn.lock exists)
7+ COPY package.json yarn.lock ./
8+ RUN yarn install --frozen-lockfile
9+
10+ # Copy source and build
11+ COPY . .
12+ RUN yarn build
13+
14+ # Stage 2: serve with node
15+ FROM node:24-alpine
16+
17+ WORKDIR /app
18+
19+ ENV NODE_ENV=production
20+ # Uncomment the following line in case you want to disable telemetry during runtime.
21+ ENV NEXT_TELEMETRY_DISABLED=1
22+
23+ RUN addgroup --system --gid 1001 nodejs && adduser --system --uid 1001 nextjs
24+
25+ COPY --from=builder /app/public ./public
26+ COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
27+ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
28+
29+ USER nextjs
30+
31+ EXPOSE 3000
32+
33+ ENV PORT=3000
34+ ENV HOSTNAME="0.0.0.0"
35+ CMD [ "node" , "server.js" ]
Original file line number Diff line number Diff line change 1+ services :
2+ web :
3+ build :
4+ context : .
5+ dockerfile : Dockerfile
6+ env_file : .env
7+ ports :
8+ - " 3000:3000"
Original file line number Diff line number Diff line change 11/** @type {import('next').NextConfig } */
22const nextConfig = {
33 reactStrictMode : true ,
4- swcMinify : true ,
4+ output : "standalone" ,
55} ;
66
77module . exports = nextConfig ;
You can’t perform that action at this time.
0 commit comments