You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for this amazing repo! I’m using it in a couple of projects, and it’s been incredibly helpful.
Would you consider adding a Dockerfile? I tried using the official Next.js Dockerfile, but deployment takes an extremely long time (around 30 minutes on a VPS).
Best regards!
The text was updated successfully, but these errors were encountered:
Unfortunately NextJS can be a bit annoying for Docker.
To reduce the build time problem, you can build on your machine, or on a server (like Github Actions) and upload to a docker registry.
If you want a ready-made Dockerfile, I use this one:
!! (you will have problems with it if you are using NEXT_PUBLIC variables)
FROM node:21-alpine AS base
RUN apk add --no-cache libc6-compat
FROM base AS dev
WORKDIR /usr/app
COPY package*.json ./
RUN npm ci
FROM base AS build
WORKDIR /usr/app
ENV NODE_ENV="production"
COPY --from=dev /usr/app/package*.json ./
COPY --from=dev /usr/app/node_modules ./node_modules
COPY . .
RUN rm -rf *.env
RUN npm run build
RUN npm prune --production
FROM base AS prod
WORKDIR /usr/app
COPY --from=build /usr/app/.next ./.next
COPY --from=build /usr/app/node_modules ./node_modules
COPY --from=build /usr/app/package*.json ./
CMD ["npm", "run", "start"]
Hi Kiranism,
Thank you for this amazing repo! I’m using it in a couple of projects, and it’s been incredibly helpful.
Would you consider adding a Dockerfile? I tried using the official Next.js Dockerfile, but deployment takes an extremely long time (around 30 minutes on a VPS).
Best regards!
The text was updated successfully, but these errors were encountered: