From 9a67710ec332403520db523661f5f1a84402055c Mon Sep 17 00:00:00 2001 From: pedro Date: Fri, 26 Jan 2024 03:44:56 +0100 Subject: [PATCH] new Dockerfiles for musician and orchestra orchestra: 1.28GB -> 848MB musician: 497MB -> 169MB --- docker/musician.Dockerfile | 23 ++++++++++++---------- docker/orchestra.Dockerfile | 38 +++++++++++++++++++++++++------------ 2 files changed, 39 insertions(+), 22 deletions(-) diff --git a/docker/musician.Dockerfile b/docker/musician.Dockerfile index b539024..f8c9f84 100644 --- a/docker/musician.Dockerfile +++ b/docker/musician.Dockerfile @@ -1,16 +1,19 @@ -# right now this is this is heavily inspired to git repo django-musician/Dockerfile -#FROM python -FROM debian:bullseye-slim - -RUN apt update && apt-get install -y \ - python3-minimal \ - python3-pip \ - python3-dev \ - python-is-python3 +FROM python:3.11.7-slim-bookworm WORKDIR /opt/musician -RUN python3 -m pip install --upgrade pip +# reduce size (python specifics) -> src https://stackoverflow.com/questions/74616667/removing-pip-cache-after-installing-dependencies-in-docker-image +ENV PYTHONDONTWRITEBYTECODE=1 +# here document in dockerfile src https://stackoverflow.com/questions/40359282/launch-a-cat-command-unix-into-dockerfile +RUN cat > /etc/pip.conf < src https://stackoverflow.com/questions/74616667/removing-pip-cache-after-installing-dependencies-in-docker-image +ENV PYTHONDONTWRITEBYTECODE=1 +# here document in dockerfile src https://stackoverflow.com/questions/40359282/launch-a-cat-command-unix-into-dockerfile +RUN cat > /etc/pip.conf < src https://discuss.python.org/t/how-to-install-uwsgi-package-from-pypi/25082/5 +# setuptools before installing requirements and the anyjson python package -> src https://stackoverflow.com/questions/72414481/error-in-anyjson-setup-command-use-2to3-is-invalid/74272722#74272722 +RUN pip install \ + "setuptools<58.0.0" \ + psycopg2-binary \ + pyuwsgi # Clean up to reduce image size RUN apt clean && rm -rf /var/lib/apt/lists/* @@ -86,8 +100,8 @@ WORKDIR /opt/orchestra/ COPY django-orchestra/requirements.txt . # TODO fix this better in the repo itself -RUN pip3 install -r requirements.txt -RUN pip3 install lxml==4.9.3 +RUN pip install -r requirements.txt +RUN pip install lxml==4.9.3 COPY django-orchestra . #RUN sed -i 's/lxml==3.3.5/lxml==4.9.3/' requirements.txt