new Dockerfiles for musician and orchestra

orchestra: 1.28GB -> 848MB
musician:   497MB -> 169MB
This commit is contained in:
pedro 2024-01-26 03:44:56 +01:00
parent 45eef003a7
commit 9a67710ec3
2 changed files with 39 additions and 22 deletions

View File

@ -1,16 +1,19 @@
# right now this is this is heavily inspired to git repo django-musician/Dockerfile FROM python:3.11.7-slim-bookworm
#FROM python
FROM debian:bullseye-slim
RUN apt update && apt-get install -y \
python3-minimal \
python3-pip \
python3-dev \
python-is-python3
WORKDIR /opt/musician 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 <<END
[install]
compile = no
[global]
no-cache-dir = True
END
RUN pip install --upgrade pip
RUN pip install wheel RUN pip install wheel
COPY django-musician/requirements.txt . COPY django-musician/requirements.txt .

View File

@ -1,4 +1,4 @@
FROM debian:bullseye-slim FROM python:3.9.18-slim-bullseye
# based on https://github.com/glic3rinu/django-orchestra/blob/master/INSTALL.md # based on https://github.com/glic3rinu/django-orchestra/blob/master/INSTALL.md
# HOW TO RUN THIS # HOW TO RUN THIS
@ -15,15 +15,10 @@ FROM debian:bullseye-slim
#RUN apt-get update -y && apt-get upgrade -y #RUN apt-get update -y && apt-get upgrade -y
RUN apt update && apt-get install -y \ RUN apt update && apt-get install --no-install-recommends -y \
python3-minimal \
python3-pip \
postgresql \ postgresql \
python3-psycopg2 \
cron \ cron \
nginx-full \ nginx-full \
uwsgi \
uwsgi-plugin-python3 \
sudo \ sudo \
ca-certificates \ ca-certificates \
gettext \ gettext \
@ -36,13 +31,32 @@ RUN apt update && apt-get install -y \
ssh \ ssh \
wkhtmltopdf \ wkhtmltopdf \
xvfb \ xvfb \
python3-minimal \
python3-dev \
zlib1g-dev \ zlib1g-dev \
libcrack2-dev \ libcrack2-dev \
libxml2-dev \ libxml2-dev \
libxslt1-dev \ libxslt1-dev \
python-is-python3 && rm -rf /var/lib/apt/lists/*
# 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 <<END
[install]
compile = no
[global]
no-cache-dir = True
END
RUN pip install --upgrade pip
# using binaries I avoid installing c compiler
# pyuwsgi -> 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 # Clean up to reduce image size
RUN apt clean && rm -rf /var/lib/apt/lists/* RUN apt clean && rm -rf /var/lib/apt/lists/*
@ -86,8 +100,8 @@ WORKDIR /opt/orchestra/
COPY django-orchestra/requirements.txt . COPY django-orchestra/requirements.txt .
# TODO fix this better in the repo itself # TODO fix this better in the repo itself
RUN pip3 install -r requirements.txt RUN pip install -r requirements.txt
RUN pip3 install lxml==4.9.3 RUN pip install lxml==4.9.3
COPY django-orchestra . COPY django-orchestra .
#RUN sed -i 's/lxml==3.3.5/lxml==4.9.3/' requirements.txt #RUN sed -i 's/lxml==3.3.5/lxml==4.9.3/' requirements.txt