File tree Expand file tree Collapse file tree 2 files changed +13
-26
lines changed
Expand file tree Collapse file tree 2 files changed +13
-26
lines changed Original file line number Diff line number Diff line change 11[build ]
22builder = " dockerfile"
3- dockerfilePath = " Dockerfile"
3+ dockerfilePath = " website/ Dockerfile"
44
55[deploy ]
66restartPolicyType = " ON_FAILURE"
Original file line number Diff line number Diff line change 11# Next.js Production Dockerfile for Railway
2- # Build context is the website/ directory
3- FROM node:20-alpine AS base
2+ # Build context: website/
3+ FROM node:20-alpine
44
5- # Dependencies stage
6- FROM base AS deps
7- RUN apk add --no-cache libc6-compat
85WORKDIR /app
96
7+ # Install dependencies
108COPY package.json package-lock.json* ./
119RUN npm ci
1210
13- # Builder stage
14- FROM base AS builder
15- WORKDIR /app
16- COPY --from=deps /app/node_modules ./node_modules
11+ # Copy source
1712COPY . .
1813
14+ # Build the app
1915ENV NEXT_TELEMETRY_DISABLED=1
2016RUN npm run build:railway
2117
22- # Runner stage
23- FROM base AS runner
24- WORKDIR /app
18+ # Copy static assets to standalone
19+ RUN cp -r .next/static .next/standalone/.next/static
20+ RUN cp -r public .next/standalone/public
2521
22+ # Runtime
2623ENV NODE_ENV=production
27- ENV NEXT_TELEMETRY_DISABLED=1
28-
29- RUN addgroup --system --gid 1001 nodejs
30- RUN adduser --system --uid 1001 nextjs
31-
32- COPY --from=builder /app/public ./public
33- COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
34- COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
35-
36- USER nextjs
37-
38- EXPOSE 3000
3924ENV PORT=3000
40- ENV HOSTNAME="0.0.0.0"
25+ ENV HOSTNAME=0.0.0.0
26+ EXPOSE 3000
4127
28+ WORKDIR /app/.next/standalone
4229CMD ["node" , "server.js" ]
You can’t perform that action at this time.
0 commit comments