You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Docker image build where virtual environment is not preferred over global installation.
Why not keep everything in a local environment? Never install anything globally.
Using poetry environments inside docker works as expected.
FROM python:3.11-slim
RUN pip install pip poetry -U
WORKDIR /usr/src
# Copy dependency setupCOPY pyproject.toml poetry.lock .
# install dependencies before the code copy so code updates don't trigger all deps being pulled every timeRUN poetry install --only main
# copy your code directoryCOPY modulename modulename
# double install because poetry requires it to stop complaining about script commands now# (may also require copying your README.md since poetry cares about it now too)RUN poetry install
CMD ["poetry", "run", "my-server"]
There are various reason, one of them is to load driver, as an example GPU driver.
I found a way, using environment variable POETRY_VIRTUALENVS_CREATE=false, and we can close this issue.
Example:
POETRY_VIRTUALENVS_CREATE=false poetry install --only main --no-cache --no-interaction
Feature Request
Please add a flag to install packages into global environment without of having to configure
poetry config virtualenvs.create false
ie.
poetry install --global
similar to
pipenv install --system
Main use case: Docker image build where virtual environment is not preferred over global installation.
The text was updated successfully, but these errors were encountered: