by Edgar Roman, 06-16-2017.
In a previous post, Matthew Crowson reviewed how to get a docker environment that closely resembles the AWS lambda environment. This allows you to have a local environment that can be used to debug package and other system library installations.
Since that blog post was published, AWS announced support for Python 3.6 and some things have changed. This post goes through the process of setting up your own docker environment for zappa using Python 3.6.
We'll pull directly from the lambci images directly by running:
docker pull lambci/lambda:build-python3.6
The Dockerfile is important to allow you to customize any system library dependencies.
If you need to compile stuff or install any packages that are not in lambda-packages you can install them using Dockerfile
Easy by running
docker build -t myzappa .
Now you can easily start up the docker container by:
And setup your virtual environment
python -m venv ve
pip install -r requirements.txt
NOTE: It is very important that you create, activate, and install packages into the virtualenv only in the docker shell. This will prevent any incompatibilities with the local system environment and the docker environment.
More info including a dual-python version setup can be found here