Skip to content

Commit

Permalink
Cleanup backend dockerfile
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
  • Loading branch information
eternaltyro committed May 16, 2024
1 parent 7bfb472 commit 74a705a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions scripts/docker/Dockerfile.backend
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -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 \
Expand Down Expand Up @@ -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"]
Expand All @@ -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"]

0 comments on commit 74a705a

Please sign in to comment.