title: Can't build zip file for AWS lambda using Linux Alpine docker
body: <p>I have Dockerfile based on Alpine linux that builds lambda.zip file for AWS Lambda.
  Here's Dockerfile:</p>
  <pre><code>FROM alpine:3.12
  
  # -- Install OS packages:
  RUN apk add gcc
  RUN apk add --update --no-cache \
      bash \
      build-base \
      cargo \
      curl \
      docker \
      # gcc \
      git \
      g++ \
      lftp \
      libc-dev \
      libffi-dev \
      libsodium-dev \
      libxslt-dev\
      libzmq \ 
      zeromq-dev \
      make \
      musl-dev \
      ncftp \
      nodejs \
      npm \
      openssh-client \
      openssl \
      openssl-dev \
      rsync \
      su-exec \
      tar \
      wget \
      zip 
  # geos \ 
  # geos-dev \
  # libc-dev 
  
  WORKDIR /tmp/
  
  RUN echo &quot;http://mirror.leaseweb.com/alpine/edge/community&quot; &gt;&gt; /etc/apk/repositories
  RUN echo &quot;http://dl-cdn.alpinelinux.org/alpine/edge/community&quot; &gt;&gt; /etc/apk/repositories
  RUN apk add --virtual .build-deps \
      --repository http://dl-cdn.alpinelinux.org/alpine/edge/community \
      --repository http://dl-cdn.alpinelinux.org/alpine/edge/main \
      libc-dev geos-dev geos &amp;&amp; \
      runDeps=&quot;$(scanelf --needed --nobanner --recursive /usr/local \
      | awk '{ gsub(/,/, &quot;\nso:&quot;, $2); print &quot;so:&quot; $2 }' \
      | xargs -r apk info --installed \
      | sort -u)&quot; &amp;&amp; \
      apk add --virtual .rundeps $runDeps
  
  RUN geos-config --cflags
  
  # -- Install python:
  RUN apk add --update --no-cache python3-dev python3 \
      &amp;&amp; python3 -m ensurepip --upgrade \
      &amp;&amp; pip3 install --upgrade pip pipenv setuptools docker-compose awscli shapely wheel \
      &amp;&amp; rm -r /usr/lib/python*/ensurepip  \
      &amp;&amp; if [ ! -e /usr/bin/pip ]; then ln -s pip3 /usr/bin/pip ; fi \
      &amp;&amp; if [[ ! -e /usr/bin/python ]]; then ln
  </code></pre>
  <p>Here's script that works on docker Alpine image and builds lambda.zip that contains python files and all needed dependencies like boto3, pip, six etc.</p>
  <pre><code> 
  #!/bin/bash
  
  set -x
  set -e
  
  pipenv install
  rm -rf lambda.zip
  
  VENV=$(pipenv --venv)
  TEMPDIR=$(mktemp -d)
  
  rsync -r --progress ./* ${TEMPDIR}
  rsync -r --progress ${VENV}/lib/python3.8/site-packages/* ${TEMPDIR}
  
  pushd ${TEMPDIR}
  zip -r lambda.zip ./*
  popd
  
  cp ${TEMPDIR}/lambda.zip ./
  
  cleanup() {
      rm -rf ${TEMPDIR}
  }
  
  trap cleanup EXIT
  </code></pre>
  <p>Then I copy this lambda.zip to my local machine, unzip it and  enable pipenv on my local machine to use only that packages in lambda.zip and i try to test Shapely package, for example test.py:</p>
  <pre><code>from shapely.geometry import Polygon
  print(Polygon([[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]).minimum_clearance)
  </code></pre>
  <p>On AWS lambda and on my local machine I am getting same error with geos_c After:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;test.py&quot;, line 1, in &lt;module&gt;
      from shapely.geometry import Polygon
    File &quot;/home/stark/code/job/lamba_python_312_stack/shapely/geometry/__init__.py&quot;, line 4, in &lt;module&gt;
      from .base import CAP_STYLE, JOIN_STYLE
    File &quot;/home/stark/code/job/lamba_python_312_stack/shapely/geometry/base.py&quot;, line 19, in &lt;module&gt;
      from shapely.coords import CoordinateSequence
    File &quot;/home/stark/code/job/lamba_python_312_stack/shapely/coords.py&quot;, line 8, in &lt;module&gt;
      from shapely.geos import lgeos
    File &quot;/home/stark/code/job/lamba_python_312_stack/shapely/geos.py&quot;, line 87, in &lt;module&gt;
      _lgeos = load_dll('geos_c', fallbacks=alt_paths)
    File &quot;/home/stark/code/job/lamba_python_312_stack/shapely/geos.py&quot;, line 60, in load_dll
      raise OSError(
  OSError: Could not find lib geos_c or load any of its variants ['libgeos_c.so.1', 'libgeos_c.so'].
  </code></pre>
  <p>If I unzip file, I got something like these:</p>
  <pre><code>@user# ls
  
  iohttp
  aiohttp-3.7.4.post0.dist-info
  attr
  attrs-21.2.0.dist-info
  boto3
  boto3-1.18.38.dist-info
  botocore
  cron_runner.py
  setuptools-58.0.4.virtualenv
  shapely
  Shapely-1.7.1.dist-info
  ...
  xmltodict.py
  yarl
  yarl-1.6.3.dist-info
  
  </code></pre>
  <p>I tried a lot of different solutions on Internet so you can see a mess in my Dockerfile, but they didn't work.</p>