Short version: a Dockerfile when you need control, Nixpacks when you want the build worked out for you. Both give you a container image.
The part people miss: the Nixpacks README now says the project "is currently in maintenance mode and is not under active development" and recommends Railpack. It still works, but plan for a Dockerfile fallback.
How Nixpacks detects a stack, how nixpacks.toml overrides it, and which builder CloudPloy picks are in the original post: https://cloudploy.com/blog/nixpacks-vs-dockerfile

