From 75905c3e45dd045d8517f78f9d9b39d064f0c937 Mon Sep 17 00:00:00 2001 From: Tom Stein Date: Thu, 5 Jan 2023 20:55:02 +0100 Subject: [PATCH] fixed location for poetry venv in docker image --- Dockerfile | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index c3d37da..8695862 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,25 @@ # Container image that runs your code FROM python:3.11-slim-buster +# pip +ENV PIP_NO_CACHE_DIR=off \ + PIP_DISABLE_PIP_VERSION_CHECK=on \ + PIP_DEFAULT_TIMEOUT=100 + +# poetry +ENV POETRY_VERSION=1.2.2 \ + POETRY_NO_INTERACTION=1 \ + POETRY_CACHE_DIR='/var/cache/pypoetry' \ + PYSETUP_PATH="/opt/pysetup" \ + VENV_PATH="/opt/pysetup/.venv" \ + PATH="$VENV_PATH/bin:$PATH:/root/.local/bin" + + RUN python3.11 -m pip install pipx -RUN pipx install "poetry==1.2.2" +RUN pipx install "poetry==$POETRY_VERSION" # We need to ensure taht poetry is available (alternative: RUN pipx ensurepath) -ENV PATH="{PATH}:/root/.local/bin" - +# ENV PATH="{PATH}:/root/.local/bin" +RUN pipx ensurepath # We copy just the pyproject.toml and pyproject.lock first to leverage Docker cache COPY pyproject.toml poetry.lock ./