Deploying nextjs applications always gets stuck in the Creating an optimized production build...
When I deploy nextjs application, it always fails. I'm stuck here and can't proceed to the next step. It still looks like this even after a few hours. I have attached some of the logs and dockerfile of dokploy。
In addition, the server I use is digitalocean’s droplet
Very much looking forward to your help, thank you very much


12 Replies
Try with nixpacks
Without dockerfile
I don’t know but probably the dockefile are missing something, can you try nixpacks just to see if the build is fine?
Each stage takes a long time, and sometimes it gets stuck here. Is it because the host's network is not good?

This time I used nixpacks
And it works ?
No, I'm stuck again. It's the same picture I sent you just now. The progress has not changed until now. I wonder if there is something wrong with my server。
My configuration is this。My project is currently running well in vercel, because vercel has limitations on request time and file writing, so I want to try deploying it on my own server

Can you try to deploy this https://github.com/Dokploy/examples/tree/main/nextjs
GitHub
examples/nextjs at main · Dokploy/examples
Examples to deploy on Dokploy. Contribute to Dokploy/examples development by creating an account on GitHub.
Follow the instructions in the readme
In the case of doesn’t work probably is something with your server 😅
OK, I'll try
This simple nextjs project was deployed successfully. However, I use a lot of dependencies in my project. Maybe because of dependency conflict? However, the deployment on vercel does not prompt any dependency conflicts and can be successful.
Which version of node you use ?
Try to put in environment NIXPACKS_NODE_VERSION = your_node_version
If your project is big you have two ways to fix that, the first one is building the application in a ci/cd and pushing to docker registry or any other registry and in dokploy just download and run the image, the second one is you need to increase the resources since your application is too big probably is taking to much resources
The version used in local development is v20.13.1. I'll try it later
ok, I'll try, thank you
I upgraded the server configuration so it now has 4G of RAM and fixed some build errors. Now it has been successful. Generally speaking, it still has a lot to do with the server configuration.