Skip to content

Commit bcd1c6c

Browse files
fix: Move Dockerfile to website/ directory
1 parent dff9a76 commit bcd1c6c

File tree

2 files changed

+13
-26
lines changed

2 files changed

+13
-26
lines changed

railway.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build]
22
builder = "dockerfile"
3-
dockerfilePath = "Dockerfile"
3+
dockerfilePath = "website/Dockerfile"
44

55
[deploy]
66
restartPolicyType = "ON_FAILURE"

website/Dockerfile

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,29 @@
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
85
WORKDIR /app
96

7+
# Install dependencies
108
COPY package.json package-lock.json* ./
119
RUN 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
1712
COPY . .
1813

14+
# Build the app
1915
ENV NEXT_TELEMETRY_DISABLED=1
2016
RUN 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
2623
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
3924
ENV 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
4229
CMD ["node", "server.js"]

0 commit comments

Comments
 (0)