aboutsummaryrefslogtreecommitdiffstats
path: root/Dockerfile
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2022-09-18 00:42:22 +0400
committerGravatar Hassan Abouelela <[email protected]>2022-09-18 00:58:13 +0400
commit9eefe452b31b2827bfe34d7cc764120e10d38ad3 (patch)
tree08acc0a798af24bae4731a55f9d958d9672c0cef /Dockerfile
parentMerge pull request #199 from python-discord/dependabot/pip/spectree-0.10.5 (diff)
Fix Poetry 1.2 Support
Poetry 1.2 introduced a regression which broke pip `--user` installs. These types of install were the main way we did installations in docker and CI, as they made it much more convenient to control the location, availability, and caching of packages. Poetry's team does not recognize this as a supported use case, so major changes were required to get everything working again. Most of the changes were consolidated into chrislovering/python-poetry-base for docker, and HassanAbouelela/setup-python for CI. Signed-off-by: Hassan Abouelela <[email protected]>
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile16
1 files changed, 5 insertions, 11 deletions
diff --git a/Dockerfile b/Dockerfile
index ec62a8c..89060a3 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,4 +1,4 @@
-FROM --platform=linux/amd64 python:3.9-slim
+FROM --platform=linux/amd64 ghcr.io/chrislovering/python-poetry-base:3.9-slim
# Allow service to handle stops gracefully
STOPSIGNAL SIGQUIT
@@ -8,19 +8,12 @@ RUN apt-get update && \
apt-get install -y gcc make && \
apt-get clean && rm -rf /var/lib/apt/lists/*
-# Install Poetry
-RUN pip install poetry
-
-# Copy dependencies-related files
-COPY poetry.lock .
-COPY pyproject.toml .
-
# Install dependencies
-RUN poetry config virtualenvs.create false
-RUN poetry install --no-dev
+WORKDIR /app
+COPY pyproject.toml poetry.lock ./
+RUN poetry install --without dev
# Copy all files to container
-WORKDIR /app
COPY . .
# Set Git SHA build argument
@@ -30,4 +23,5 @@ ARG git_sha="development"
ENV GIT_SHA=$git_sha
# Start the server with uvicorn
+ENTRYPOINT ["poetry", "run"]
CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:8000", "-k", "uvicorn.workers.UvicornWorker", "backend:app"]