Skip to content

Commit 5a04e44

Browse files
fix: Simplify Dockerfile - remove standalone mode for reliability
1 parent c679f73 commit 5a04e44

1 file changed

Lines changed: 7 additions & 27 deletions

File tree

Dockerfile

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,22 @@
11
# Next.js Production Dockerfile for Railway
2-
# Build context is repository root, website is subdirectory
3-
FROM node:20-alpine AS base
2+
FROM node:20-alpine
43

5-
# Dependencies stage
6-
FROM base AS deps
7-
RUN apk add --no-cache libc6-compat
84
WORKDIR /app
95

6+
# Install dependencies
107
COPY website/package.json website/package-lock.json* ./
118
RUN npm ci
129

13-
# Builder stage
14-
FROM base AS builder
15-
WORKDIR /app
16-
COPY --from=deps /app/node_modules ./node_modules
10+
# Copy website source
1711
COPY website/ ./
1812

13+
# Build the app
1914
ENV NEXT_TELEMETRY_DISABLED=1
2015
RUN npm run build:railway
2116

22-
# Runner stage
23-
FROM base AS runner
24-
WORKDIR /app
25-
17+
# Runtime
2618
ENV 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
3919
ENV PORT=3000
40-
ENV HOSTNAME="0.0.0.0"
20+
EXPOSE 3000
4121

42-
CMD ["node", "server.js"]
22+
CMD ["npm", "start"]

0 commit comments

Comments
 (0)