I am building a Docker container using GitHub Actions for one of my Python/Django projects that is also using numpy.
Unfortunately the building process often takes more than 20 minutes, because everytime numpy is being build again.
Also trying to use wheel for it doesn't speed up the process. As I am using versions in my requirements.txt it is also not possible to just install the package using apt.
My Dockerfile looks like this:
FROM python:alpine
EXPOSE 8000
RUN apk update
RUN apk add --no-cache git gcc musl-dev libffi-dev libxml2-dev libxslt-dev gcc swig g++
RUN apk add --no-cache jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev
RUN apk add --no-cache postgresql postgresql-dev
RUN apk add --no-cache bash ffmpeg libmagic
RUN python3 -m pip install --upgrade pip setuptools wheel
RUN mkdir /opt/proj
WORKDIR /opt/proj
COPY . .
RUN pip3 install wheel
RUN pip3 install -r requirements.txt
RUN pip3 install gunicorn
CMD sh -c 'cat /opt/proj/.env'
CMD sh -c 'gunicorn --conf python:proj.gunicorn_conf proj.wsgi --bind 0.0.0.0:8000 --reload --log-level info --access-logfile - --timeout 360 --error-logfile -'
Any suggestions or hints are welcome.