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
No description
No description
12 Replies
𝗠𝗿𝟭𝗕𝗹𝗮𝘇𝗲
Try with nixpacks Without dockerfile
Siumauricio
Siumauricio9mo ago
I don’t know but probably the dockefile are missing something, can you try nixpacks just to see if the build is fine?
ningshen
ningshenOP9mo ago
Each stage takes a long time, and sometimes it gets stuck here. Is it because the host's network is not good?
No description
ningshen
ningshenOP9mo ago
This time I used nixpacks
Siumauricio
Siumauricio9mo ago
And it works ?
ningshen
ningshenOP9mo ago
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
No description
Siumauricio
Siumauricio9mo ago
GitHub
examples/nextjs at main · Dokploy/examples
Examples to deploy on Dokploy. Contribute to Dokploy/examples development by creating an account on GitHub.
Siumauricio
Siumauricio9mo ago
Follow the instructions in the readme In the case of doesn’t work probably is something with your server 😅
ningshen
ningshenOP9mo ago
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
Siumauricio
Siumauricio9mo ago
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
ningshen
ningshenOP9mo ago
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.

Did you find this page helpful?