I want some thoughts on best practices when working on nextjs with docker. My stack is nextjs, postgres, and prisma as my ORM. I want to deploy to a docker container. As this is my first time containerizing an application I have some questions.
- Should the container only be used for prod? i.e running npm run build, then npm run start
- Alternatively, should I run my postgres in a container, and develop through my host machine connecting to it?
- If thats not best practice, what is the best way to set up a dockerfile/compose.yml to allow for development AND production. There seems to be controversial opinions on this online, what do you guys think
I apologize if some of my information is incorrect, I am still learning about the process. But my goal is to be able to develop/hot reload/database migrations, and then deploy to a container with an optimized build whenever I like.
Thanks!