Created
March 20, 2018 10:56
-
-
Save mattmcd/e60116fddd0e963577bd284680e7e589 to your computer and use it in GitHub Desktop.
TensorFlow library install on AmazonLinux for AWS Lambda
This file contains 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
FROM amazonlinux:latest | |
MAINTAINER Matt McDonnell "[email protected]" | |
RUN yum -y -q update | |
RUN yum -y -q install python27-pip zip | |
RUN pip install -q virtualenv | |
RUN virtualenv tf_env | |
RUN source tf_env/bin/activate && \ | |
pip install -q --upgrade --ignore-installed https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.12.1-cp27-none-linux_x86_64.whl && \ | |
pip install -q pillow | |
RUN touch tf_env/lib/python2.7/site-packages/google/__init__.py | |
RUN cd tf_env/lib/python2.7/site-packages/ && zip -qr ~/tf_env.zip . --exclude \*.DS_Store \*.pyc /external/\* /tensorflow/contrib/\* /tensorflow/include/unsupported/\* | |
CMD cp ~/tf_env.zip /app/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Used to create a zip file containing numpy, tensorflow, pillow compiled on amazonlinux Docker image (same as AWS Lambda runtime environement).
Can then just run the container with shared volume to host to produce the necessary set of libraries to include in AWS Lambda zipfile
docker run --rm --mount type=bind,source=/home/mattmcd/build_tf_lambda/vendored,target=/app mattmcd/tensorflow_lambda:0.12