Skip to content

Instantly share code, notes, and snippets.

@wolfg1969
Last active April 29, 2020 04:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wolfg1969/decd1fc8ba5bb4eaf19adfb57c409c0f to your computer and use it in GitHub Desktop.
Save wolfg1969/decd1fc8ba5bb4eaf19adfb57c409c0f to your computer and use it in GitHub Desktop.
Build aws lambda layer for mysqlclient
#!/bin/bash
rm -rf lib python
mkdir -p lib
for version in "python3.6" "python3.7" "python3.8"
do
echo "Building $version ..."
mkdir -p python/lib/${version}
docker run -v "$PWD":/var/task "lambci/lambda:build-$version" /bin/sh -c "yum install -y mysql-devel && cp /usr/lib64/mysql/libmysqlclient* lib/ && pip install mysqlclient -t python/lib/$version/site-packages/ && exit"
done
zip -r mysqlclient-lambda-layer.zip lib python > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment