Abhishek
Abhishek9mo ago

Convex and nextjs , docker hosting possible ?

Is it possible to build a docker image of nextjs with convex and host it on vps ? I am tring to move away from vercel and thinking of buying vps and using https://coolify.io/
Coolify
Coolify
An open-source & self-hostable Heroku / Netlify / Vercel alternative.
8 Replies
jamwt
jamwt9mo ago
yep, this is pretty doable. you can just package up your built next.js project into a docker image. https://nextjs.org/docs/pages/building-your-application/deploying#docker-image
Building Your Application: Deploying | Next.js
Learn how to deploy your Next.js app to production, either managed or self-hosted.
jamwt
jamwt9mo ago
as long as the right env variable is set for your convex backend URL, the app will still connect to your convex backend
Abhishek
AbhishekOP9mo ago
So we dont need to override any command like we do in npx convex deploy --cmd 'npm run build'
jamwt
jamwt9mo ago
nope, but you'll just need to deploy separately to your convex deployment with npx convex deploy when you want to update your production backend
ian
ian9mo ago
One idea is you could have your deploy script do the npx convex deploy --cmd 'build and deploy docker here, using the env variables populated by npx convex deploy' e.g. building the container passing in the convex url as a param to docker
Abhishek
AbhishekOP9mo ago
Thanks @ian , now I have to start learning docker to write the script
ian
ian9mo ago
Or if you’re using fly, you can set the env with their cli then just do the fly deploy. Or avoid it all and just hardcode prod url - this is all just to get dynamic URLs for preview deploys
Abhishek
AbhishekOP7mo ago
Thanks successfully migrated from Vercel to coolify currently I am manually doing npx convex deploy

Did you find this page helpful?