Dockerised apps for building, running, testing and deploying lambda functions.
5.0K
Dockerised apps for building, running, testing and deploying AWS Lambda functions.
Python 2.7 and 3.6 are currently supported. The latest Docker images are available from the amphio/bootlambda Dockerhub repository.
cd to a directory containing your lambda app structured as followed:
- app/
- __init__.py
- lambda_funcion.py
- other_module.py
- test_other_module.py
- requirements.txt
- lambda-config.list
..then
docker run -it --rm \
-v ${PWD}/app:/usr/src/app/app \
-v ${PWD}/requirements.txt:/usr/src/app/requirements.txt \
--env-file ./lambda-config.list \
amphio/bootlambda:py3.6-v0.1.2
This will pull the bootlambda image from here. You should now be inside the container at a shell prompt looking something like this: root@18e941d745dd:/usr/src/app#
Once setup, you can build your lambda app with dependencies
bash bootlambda.sh build-dev
Import latest code changes then run tests and call main function app
bash bootlambda.sh run-dev
Run your unittests prefixed test_ in app/
bash bootlambda.sh test-dev
Once setup, you can build your lambda app with dependencies
bash bootlambda.sh build
To run the app with variables defined in lambda-config.list
bash bootlambda.sh run
To run your unittests prefixed test_ in app/
bash bootlambda.sh test
To zip up your code and deploy it to AWS
bash bootlambda.sh deploy <name of S3 bucket> <name of lambda function>
These should be stored in app/ directory with filename of form:
test_<some module>.py
e.g.
test_controly.py
Images are hosted on dockerhub [here]((https://hub.docker.com/r/amphio/bootlambda/):
cd <this dir>
# Python 2.7
docker build -t amphio/bootlambda:py2.7-<version> ./python2.7
docker push amphio/bootlambda:py2.7-<version>
# Python 3.6
docker build -t amphio/bootlambda:py3.6-<version> ./python3.6
docker push amphio/bootlambda:py3.6-<version>
Content type
Image
Digest
Size
374.2 MB
Last updated
almost 9 years ago
docker pull amphio/bootlambda:py3.6-v0.1.31