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/
8 Replies
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.
as long as the right env variable is set for your convex backend URL, the app will still connect to your convex backend
So we dont need to override any command like we do in
npx convex deploy --cmd 'npm run build'
nope, but you'll just need to deploy separately to your convex deployment with
npx convex deploy
when you want to update your production backendOne 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 dockerThanks @ian , now I have to start learning docker to write the script
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 deploysThanks successfully migrated from Vercel to coolify currently I am manually doing
npx convex deploy