Installing Shapely on Alpine docker

Solution:

I struggled with the same issue (not working with Django and PostGres database though).

Finally I managed to tackle this with the solution of Amir. I added the repositories from dl-cdn.alpinelinux.org according to https://github.com/appropriate/docker-postgis/blob/master/Dockerfile.alpine.template. The part that was crucial was running geos-config after the implementation of geos-dev and geos. After this I installed the python modules, including pandas. At the clean up section .build-deps is skipped as said.

This is the part of my Dockerfile that did the trick:

...
RUN apk --update add build-base libxslt-dev

RUN apk add --virtual .build-deps \
        --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \
        --repository http://dl-cdn.alpinelinux.org/alpine/edge/main \
        gcc libc-dev geos-dev geos && \
    runDeps="$(scanelf --needed --nobanner --recursive /usr/local \
    | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
    | xargs -r apk info --installed \
    | sort -u)" && \
    apk add --virtual .rundeps $runDeps

RUN geos-config --cflags

RUN pip install --disable-pip-version-check -r requirements.txt

RUN apk del build-base python3-dev && \
    rm -rf /var/cache/apk/*
...

By the way, I also tried the solution provided on https://github.com/calendar42/docker-python-geos/blob/master/Dockerfile. But this didn't work out for me.