aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2022-09-13 00:25:36 +0100
committerGravatar Chris Lovering <[email protected]>2022-09-13 00:25:36 +0100
commit71b1802b0f91b855443fa5ed01d9134944fd6f38 (patch)
tree3a021a151a9d5964116b021c25288a98c49119a6
parentMerge pull request #2268 from python-discord/pin-poetry-to-1.1.X (diff)
Ignore mounted in-project venvs on startup
Poetry's virtualenvs.in-project config deafults to None, meaning it will use in-project venvs if it finds one, otherwise it will use the cache dir. In dev we mount the entire root project directory to /bot. This means if the host's venv in in the project dir, this will get mounted and prioritised by poetry run. If the host is on a non-linux OS this will cause poetry to fail to boot.
-rw-r--r--Dockerfile5
1 files changed, 4 insertions, 1 deletions
diff --git a/Dockerfile b/Dockerfile
index 9cf9c7b27..da65bbf3b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -3,9 +3,12 @@ FROM --platform=linux/amd64 python:3.10-slim
# Define Git SHA build argument for sentry
ARG git_sha="development"
+# POETRY_VIRTUALENVS_IN_PROJECT is required to ensure in-projects venvs mounted from the host in dev
+# don't get prioritised by `poetry run`
ENV POETRY_VERSION=1.2.0 \
POETRY_HOME="/opt/poetry" \
POETRY_NO_INTERACTION=1 \
+ POETRY_VIRTUALENVS_IN_PROJECT=false \
APP_DIR="/bot" \
GIT_SHA=$git_sha
@@ -21,7 +24,7 @@ RUN curl -sSL https://install.python-poetry.org | python
# Install project dependencies
WORKDIR $APP_DIR
COPY pyproject.toml poetry.lock ./
-RUN poetry install --no-dev
+RUN poetry install --without dev
# Copy the source code in last to optimize rebuilding the image
COPY . .