python - Proper usage of pip from Docker -
i want install packages pip in container. trivial way following:
from ubuntu:trusty run apt-get update && \ apt-get install python-pip <lots-of-dependencies-needed-only-for-pip-install> run pip install <some-packages> however, way install lot of unneeded dependencies, increases size of container unnecessarily.
my first idea this:
from ubuntu:trusty pip_install run apt-get update && \ apt-get install python-pip <lots-of-dependencies-needed-only-for-pip-install> run pip install <some-packages> ubuntu:trusty run apt-get update && \ apt-get install python-pip <runtime-dependencies> copy --from=pip_install /usr/local/bin /usr/local/bin copy --from=pip_install /usr/local/lib/python2.7 /usr/local/lib/python2.7 this works, feels workaround. there more elegant way of doing this? thought of this:
from ubuntu:trusty pip_install run apt-get update && \ apt-get install python-pip <lots-of-dependencies-needed-only-for-pip-install> run pip install <some-packages> volume /usr/local ubuntu:trusty <somehow mount /usr/local pip_install /tmp/pip> run apt-get update && \ apt-get install python-pip <runtime-dependencies> run pip install <from /tmp/pip> <some-packages> is possible?
i have used of python images, in real application derive image derives ubuntu:trusty. question, it's beside point.
Comments
Post a Comment