Docker is the way. Darwin is a mess for development, but it doesn't matter. Start with a 137 MB bare-bones Debian image, add just what you need, Docker is the way.
I'm coming from a web development perspective. When the browser is your gui, or your app doesn't need one, Docker (running on Linux, Mac, or, cough, Windows) just takes away your concerns about environment consistency. Like a VM, but not really. A "container", a minimal Linux image, running a "service" for your app, is a beautiful and portable thing! (Looks like running guis on Mac from Docker is messy: https://cntnr.io/running-guis-with-docker-on-mac-os-x-a14df6...)