FROM suitable-base-image
ADD ./install.sh /tmp
RUN chmod a+rx /tmp/install.sh && /tmp/install.sh
and write a script to install the dependencies that people can opt to run outside of Docker if they prefer.The point is not to take away peoples ability to pull together all of the dependencies on their own, but to make replicating the build environment trivial.
Personally I don't want install scripts etc. polluting my server or laptop setups - I always spin up containers to run builds in these days, because it means I at the end have a repeatable description of how to set it up. But once someone has done that job once, it's silly for everyone else to have to repeat it.
Docker maybe makes sense as a "compilation target" - generating a dockerfile of your dependencies to make it easy for people to use makes sense. But it's not rich or structured enough to be the canonical record of what dependencies your project needs.
I'm not arguing for it to be that, and I largly agree with you.
As my example shows, the Dockerfile doesn't need to contain any detail of the dependencies - you can "outsource" that entirely to whatever mechanism you wish, as long as you can easily add whatever you need to apply those dependencies to a suitable base image to the Dockerfile.
But most of the time I don't care about precision - I just want a means of getting a working build environment quickly. If it pulls in 100MB of unnecessary libraries, I don't care, if it gets me an uncomplicated way of building the project without having to assemble the dependencies myself.
For a lot of projects I come across, my experience is that because the list of build dependencies are often never automatically tested, it's a crapshoot whether or not their build instructions and dependency list will yield a working build environment on any given system.
"Even" a plain Dockerfile that is regularly used to rebuild the build environment is far superior to a text file of dependencies that is rarely to never verified.
If you want to go one better and storing more precise instructions and then use them to generate a build script or Dockerfile, then awesome.
The main thing is that absent automated testing of the build environment too, the list of dependencies isn't worth the bytes they're stored in. And a simple way of regularly testing the build environment is to rebuild it automatically.
My experience is that the dependency lists for projects that automatically rebuild the build environment - whether as Docker containers or in a chroot or any number of other ways - tends to be far more reliable.
And if you first can automatically build the build environment, it makes sense to make it easy for everyone to use that automatically built build environment.