Custom python install and code injection into container

I need to containerize my decently sized python web app. Now the python i use is built from source and had some changes made to it before being built. This means i cannot use the official images in docker hub

As far i can understand after extensive searching is that i have two options

– build from scratch/minimal image and RUN the instruction set to build python from source. this will involve editing some files before the final make altinstall. the only downside i can envisage is amount of time to boot a container from the image.

– OR i docker run a minimal image, ssh into it and install python as required and make a new custom image from the resulting state of the image.

Also the next step will be injecting code into them, either via copy from host, or via a git pull in the dockerfile.

Which method, and for what reasons, should i choose?

I am sure I'm missing some reasons over why i should choose one over the other and need some experienced dockerheads to gimme their 2 cents.

submitted by /u/parthb
[link] [comments]
Source: Reddit