jfloff / alpine-python

A small, more complete, Python Docker image based on Alpine Linux.
MIT License
481 stars 97 forks source link

Build deps removal dilemma #66

Open ykshatroff opened 4 years ago

ykshatroff commented 4 years ago

This is not a bug on its own, but rather a question of efficiency.

If I add some python library that requires binary objects to be built or run (examples: lxml requires libxml2 and libxslt, postgres psycopg2 requires libpq to run and postgresql-dev to build, etc) then I would have to essentially repeat all the installation and removal rituals in my descendant image. At the same time it would be more efficient to just have a custom dockerfile with the cleanup done once in the last stage of the build, and just docker-squash the resulting image.

Currently I see several ways out of this dilemma:

There might be other ways of doing it, any ideas/suggestions?

jfloff commented 4 years ago

I think the better way is to just have another image that builds on this one. I think this situation is the same issue I had, and that lead me to build docker-alscipy. Is this the case, correct me if I'm wrong.

I feel that the template approach would lead to the same problem, which is you would have to build them anyways. The ARG argument might be solved with the slim tag but that also requires the image to be built, and don't change that.

Any other ideas?