Creating new image - dependencies?

I’ve grabbed a copy of one of the ready-made images and now want to use it as a base for mine. however, I need git installed. as I’m doing this on a Mac, I would need brew to install git. to install brew I would need python.

I’m guessing there are images out there that contain git and node.js and stuff… how do I declare the dependencies in the Dockerfile? or how is this done?