Demo, all content is generated
Question

Docker image for my Next.js app is 1.9 GB, Railway deploys take 10 minutes

Open · 23 views · asked by hanna_w · edited

Cursor wrote this Dockerfile:

FROM node:20
WORKDIR /app
COPY . .
RUN npm install
RUN npm run build
CMD ["npm", "start"]

The image is 1.9 GB and each deploy takes around 10 minutes of which most is pushing the image. Is that normal for Next?

What I’ve tried

Switched to node:20-slim, it went to 1.4 GB. Tried to follow a multi-stage example but the app couldn't find its static files after.

Comment

Activity

30 helpers notified