Deploy fail
I deployed a small nextjs project of mine, which can be easily deployed on vercel. However, on dokploy, the cup and memory are close to 100%, and the server crashes directly. I use a brand new 2-core 4g server, and only deploy it. dokploy project, I don’t know why this is happening. The log always stays at Creating an optimized production build..., can anyone help me?

16 Replies
This is a common problem, unfortunately it is not a problem that we can fix, it is more a problem with docker & nixpacks that makes it consume too much RAM which sometimes causes your VPS to freeze for seconds, an effective solution is to basically increase the resources of your VPS or else create your own dockerfile.
I used the dockerfile deployment method, but the result still stayed at this line of logs without any changes. This is my dockerfile.
FROM node:18-alpine AS builder
RUN npm install -g pnpm
WORKDIR /app
COPY package.json pnpm-lock.yaml* ./
RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm build
FROM node:18-alpine
WORKDIR /app
COPY --from=builder /app/package.json /app/pnpm-lock.yaml* ./
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/node_modules ./node_modules
EXPOSE 3000
CMD ["pnpm", "start"]
you from china?
yes
I don't know why this kind of problems usually come from people from China, I don't know if it's a server restriction or something like that 🤔
Surely if I deploy your project it will work without problems, I do not know if it is a connection problem.
what vps provider are you using?
If so, when I deploy one of the projects, it may affect all projects on the server. For this production environment, it is catastrophic.
I am using a server in the United States, so there are no connection issues.
what provider?
I have several servers with several nextjs apps and without any problem.
aliyun
that's alibaba right?
yes
What provider do you recommend here? I'll try it.
I honestly don't trust on that one, I'll recommend Hetnzer, Digitalocean
that never failed me and the performance is abismal compared to other providers like aws, alibaba and others
OK, I'll try
I used digitalocean's 2-core 4G server deployment and built it using the same project. The build was successful, but the build process consumed a lot of resources.

This is a small nextjs project. I don’t know if he will encounter the same problem in a slightly larger project.
Yeah the build is the thing which take alot of resources, like running your application is probably nothing compared to build a project
the best thing is to build the project in a CI/CD and then in dokploy just download the image and run
Are there any CI/CD projects suitable for nextjs? I'll go find out