aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2022-09-01 21:31:33 +0100
committerGravatar Chris Lovering <[email protected]>2022-09-10 20:14:26 +0100
commit350df44731875c4e8b28fc509d83b431cfefbc5c (patch)
tree900f164ca93168aad2a591d42735bdde3ec727f5
parentMerge pull request #2234 from python-discord/infraction-durations (diff)
Use venvs with poetry in Dockerfile
This is required due to a regression in poetry, see https://github.com/HassanAbouelela/actions/pull/7
-rw-r--r--Dockerfile22
1 files changed, 16 insertions, 6 deletions
diff --git a/Dockerfile b/Dockerfile
index 5bb400658..20b099a0b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,17 +1,26 @@
FROM --platform=linux/amd64 python:3.10-slim
# Set pip to have no saved cache
-ENV PIP_NO_CACHE_DIR=false \
- POETRY_VIRTUALENVS_CREATE=false
+ENV PIP_NO_CACHE_DIR=1 \
+ PIP_DISABLE_PIP_VERSION_CHECK=on \
+ POETRY_VERSION=1.1.15 \
+ POETRY_HOME="/opt/poetry" \
+ POETRY_VIRTUALENVS_IN_PROJECT=true \
+ POETRY_NO_INTERACTION=1 \
+ INSTALL_DIR="/opt/dependencies" \
+ APP_DIR="/bot"
+ENV PATH="$POETRY_HOME/bin:/$INSTALL_DIR/.venv/bin:$PATH"
-# Install poetry
-RUN pip install -U poetry
+RUN apt-get update \
+ && apt-get -y upgrade \
+ && apt-get install --no-install-recommends -y curl \
+ && apt-get clean && rm -rf /var/lib/apt/lists/*
-# Create the working directory
-WORKDIR /bot
+RUN curl -sSL https://install.python-poetry.org | python
# Install project dependencies
+WORKDIR $INSTALL_DIR
COPY pyproject.toml poetry.lock ./
RUN poetry install --no-dev
@@ -22,6 +31,7 @@ ARG git_sha="development"
ENV GIT_SHA=$git_sha
# Copy the source code in last to optimize rebuilding the image
+WORKDIR $APP_DIR
COPY . .
ENTRYPOINT ["python3"]