Forked from ttor/create_aws_lambda_layer_matplotlib.txt
Created
November 11, 2019 22:47
-
-
Save jdcaballerov/66e1a0d51b45a548aa2f6e45e081b84c to your computer and use it in GitHub Desktop.
Create AWS Lambda Layer for Matplotlib (Python3.7)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo docker pull amazonlinux | |
sudo docker run -it amazonlinux:latest /bin/bash | |
# inside container | |
yum -y install python37 zip | |
python3 -m venv python | |
source python/bin/activate | |
pip3 install matplotlib | |
deactivate | |
rm -rf python/{bin,include,lib64,pyvenv.cfg} python/lib/python3.7/site-packages/{__pycache__,easy_install.py,numpy*,pip*,pkg_resources,setuptools*} | |
zip -r aws_lambda_python37_layer_matplotlib.zip python/ | |
# in other terminal, copy file from container to host | |
CONTAINER_ID=$(sudo docker ps|grep amazonlinux|cut -d " " -f1) | |
sudo docker cp ${CONTAINER_ID}:/aws_lambda_python37_layer_matplotlib.zip . | |
# exit container | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment