-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How import properly pip dependency #171
Comments
It's pretty straight forward using the Bazel build method: https://github.com/bazelbuild/rules_python |
All of my ci/cd pipelines are built around docker file. So l prefer to use native Docker solutions. Also the python rules are in alpha and I need to use production ready solution. |
Hello @Ducatel I use this: FROM python:3.5-jessie AS build-env
ADD /app /app
WORKDIR /app
RUN pip3 install --upgrade pip
RUN pip install -r ./requirements.txt
FROM gcr.io/distroless/python3
COPY --from=build-env /app /app
COPY --from=build-env /usr/local/lib/python3.5/site-packages /usr/local/lib/python3.5/site-packages
WORKDIR /app
ENV PYTHONPATH=/usr/local/lib/python3.5/site-packages Hope this help. |
Thanks @jiel |
yes. We dont have docker native solutions. Untill python_rules are stable, you can write a similar rule for installing from pip for a given list of python packages. |
Closing this for now. Please open if you have questions. |
Hi,
I try to make my first image build on distroless.
I wish use the python3 image with a docker multistage build.
What I did :
It's working but my source file
test.py
is mix with the pip dependency.If I set the target of pip in
--target=./site-packages
, it will be copied in output image but cannot be used by mytest.py
.I must copy my
site-packages
content to/usr/lib/python3.5
?So how I can use pip dependency "properly" ?
Thanks in advance for your help
Ps: There is any plan to upgrade python from 3.5 to 3.6 ?
The text was updated successfully, but these errors were encountered: