From 74a705a9c06668315b4b13c725fe46d588b93670 Mon Sep 17 00:00:00 2001 From: eternaltyro Date: Thu, 16 May 2024 22:03:13 +0530 Subject: [PATCH] Cleanup backend dockerfile - Upgrade pdm and pydebug versions - Reduce RUN layers for apt steps - Remove gunicorn workers parameter to allow for WEB_CONCURRENCY env Signed-off-by: eternaltyro <230743+eternaltyro@users.noreply.github.com> --- scripts/docker/Dockerfile.backend | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/scripts/docker/Dockerfile.backend b/scripts/docker/Dockerfile.backend index 11efc15c87..c9f5b46af5 100644 --- a/scripts/docker/Dockerfile.backend +++ b/scripts/docker/Dockerfile.backend @@ -25,7 +25,7 @@ FROM base as extract-deps RUN pip install --no-cache-dir --upgrade pip WORKDIR /opt/python COPY pyproject.toml pdm.lock README.md /opt/python/ -RUN pip install --no-cache-dir pdm==2.7.4 +RUN pip install --no-cache-dir pdm==2.8.0 RUN pdm export --prod --without-hashes > requirements.txt @@ -34,9 +34,8 @@ FROM base as build RUN pip install --no-cache-dir --upgrade pip WORKDIR /opt/python # Setup backend build-time dependencies -RUN apt-get update -RUN apt-get install --no-install-recommends -y build-essential -RUN apt-get install --no-install-recommends -y \ +RUN apt-get update && apt-get install --no-install-recommends -y \ + build-essential \ postgresql-server-dev-15 \ python3-dev \ libffi-dev \ @@ -79,7 +78,7 @@ COPY manage.py . FROM runtime as debug RUN pip install --user --no-warn-script-location \ - --no-cache-dir debugpy==1.6.7 + --no-cache-dir debugpy==1.8.1 CMD ["python", "-m", "debugpy", "--wait-for-client", "--listen", "0.0.0.0:5678", \ "-m", "gunicorn", "-c", "python:backend.gunicorn", "manage:application", \ "--reload", "--log-level", "error"] @@ -93,4 +92,4 @@ RUN python -c "import compileall; compileall.compile_path(maxlevels=10, quiet=1) RUN python -m compileall . USER appuser:appuser CMD ["gunicorn", "-c", "python:backend.gunicorn", "manage:application", \ - "--workers", "1", "--log-level", "error"] + "--log-level", "error"]