From c347fb026717414c575d35e2bc20a65ce03a1db3 Mon Sep 17 00:00:00 2001 From: Ernesto Rico Schmidt <ernesto@helsinki.at> Date: Mon, 26 Sep 2022 18:50:41 -0400 Subject: [PATCH] Use Poetry, update base Python image --- Dockerfile | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 62945e1c..cca5a45d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,15 @@ -FROM python:3.9-slim-bullseye AS base +FROM python:3.10-slim-bullseye AS base +ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED=1 WORKDIR /steering -COPY requirements.txt . +COPY poetry.lock pyproject.toml ./ RUN apt-get update && apt-get install -y libmagic1 curl graphviz -RUN pip install --upgrade pip setuptools -RUN pip install --no-cache-dir -r requirements.txt +RUN pip install poetry==1.2.1 +RUN poetry install EXPOSE 8000 @@ -16,10 +17,10 @@ EXPOSE 8000 FROM base AS dev VOLUME ["/steering"] -CMD ["python", "manage.py", "runserver", "0.0.0.0:8000" ] +CMD ["poetry", "run", "python", "manage.py", "runserver", "0.0.0.0:8000"] FROM base AS prod COPY . . -CMD ["sh", "-c", "gunicorn -b 0.0.0.0:8000 -w $(nproc) steering.wsgi"] +CMD ["poetry", "run", "gunicorn", "-b", "0.0.0.0:8000", "-w", "$(nproc)", "steering.wsgi"] -- GitLab