Hacker News new | ask | show | jobs
by Yusu 1023 days ago
What we do instead if to install poetry using pip in the local/builder stage and use the virtualenvs.in-project option: https://python-poetry.org/docs/configuration/#virtualenvsin-...

Then in the final stage we copy the virtualenv folder from the builder stage. So in the final image poetry is not installed and everything is still in a virtualenv.

It's definitely more complex than a requirements.txt, but this way we can have everything in the container, skip generating a requirements.txt and also not mix our application dependencies with the system ones.

Note that poetry now has recommendations for CI which also apply to docker builds. https://python-poetry.org/docs/#ci-recommendations