Open dmfigol opened 4 years ago
Not sure I understand the issue here. To the best of my knowledge, poetry's dependencies has always been vendored and, in any case, if they are vendored that shouldn't require a venv as the whole point of vendoring is to avoid conflict with the system.
The reason why there are two installs have to do with the fact that poetry is extremely slow installing dependencies so we try to cache a layer with the dependencies already installed.
I am not sure why poetry vendoring comes into play here, but it is seen in the logs that it is happening when it shouldn't.
I understand why we have two poetry install
. The second install is expected to look like this:
Step 10/11 : RUN poetry install --no-interaction
---> Running in 13f1f9d93236
Skipping virtualenv creation, as specified in config file.
Installing dependencies from lock file
Package operations: 0 installs, 1 updates, 0 removals
- Installing nornir (2.3.0)
but it isn't
IMHO a container shouldn't require a venv
. I think we should wait for python-poetry/poetry#1879 because I tried several combinations of dockerfiles and none yielded the expected result, maybe someone will document soon what's the best approach so we can re from it.
If there is no better solution proposed in a timely manner we can go with this but unless this is a major issue I'd prefer to hold on for a while.
@dbarrosop I have been using virtual environments in docker containers with Python apps almost exclusively for the last year and my experience has been great. Though I had different reasoning. I take advantage of multi-stage builds and with virtual environments, I can copy the whole virtual environment between stages. I am ok if you prefer to wait on proposed changes in the PR. I've also opened https://github.com/python-poetry/poetry/issues/1883
It seems that in poetry 1.0, its dependencies are vendored. Also, we are not using virtualenv in the Dockerfile. https://github.com/nornir-automation/nornir/blob/fda86449cbae1d2a378044f5718b5683ac31467e/Dockerfile#L19-L24 This leads to some conflicts and an extra dependency update (?) process when building a container:
The easiest solution for this is to use virtual environment in the docker container