Next.js Discord

Discord Forum

How to deploy?

Unanswered
Eastern Carpenter bee posted this in #help-forum
Open in Discord
Eastern Carpenter beeOP
Hello,

I want to deploy Next.js as a standalone Docker container because I saw a video and read articles suggesting that it is a good way to deploy Next.js outside of Vercel. However, I have almost zero knowledge about this. I did some research but am still very unsure and not confident. If anyone can provide corrections, please do.

Here are the steps I think I should take based on my research:

- Create a CI/CD pipeline with GitHub Actions to build the image.
- Deploy it with a VPS.
- Use Cloudflare Tunnel to expose my website without exposing my public IP.

So far, this is all I have gathered, but the specifics of these steps are unknown to me. Is there someone with experience who could perhaps guide me or share some resources, if possible?

23 Replies

American black bear
take a look at this example repo by next.js:
you can copy the Dockerfile example
@aychar you should look at coolify https://coolify.io/, makes it super easy to do steps one and two that you mentioned. (although not sure about the cloudflare tunnel thing)
Eastern Carpenter beeOP
I've thought about Coolify as well, but currently, it's an extra expense for me 😦
@American black bear take a look at this example repo by next.js:
Eastern Carpenter beeOP
Will do, thanks!
American black bear
coolify should be free for self-hosting
i think its only an extra expense for the cloud tier, yeah self-hosting is completely free, you just put it on your vps
American black bear
I've never tried it personally but docker is simple enough
Eastern Carpenter beeOP
It's still an extra expense because it requires more resources
If I am not mistaken, Coolify requires a minimum of 2GB of RAM.
ah yeah that is true, i had to screw with swap memory with my setup because my vps kept running out of ram while it was deploying lmao
to be fair it's literally the cheapest tier you can get on digitalocean so i shouldnt've been expecting too much
American black bear
If you are looking for really cheap VPS I really cannot recommend Hetzner enough. I am getting 4GB Ram for $3.5 a month.
American black bear
I think they have servers in US aswell
not sure tough
@aychar *to be fair* it's literally the cheapest tier you can get on digitalocean so i shouldnt've been expecting too much
Eastern Carpenter beeOP
BTW, does Digital Ocean accept virtual cards?
@American black bear I think they have servers in US aswell
Eastern Carpenter beeOP
I'm in Asia 😅
i dont think so, i tried using my cash app card (which is considered a prepaid card) and it wouldn't let me, so probably not for virtual cards either
I was gonna use it for testing purposes 😆