All Projects â†’ myrmex-org â†’ Docker Lambda Packager

myrmex-org / Docker Lambda Packager

A docker image based on Amazon Linux to create packages for AWS Lambda 🐳 🐜

Projects that are alternatives of or similar to Docker Lambda Packager

Aws Lambda Swift Sprinter
AWS Lambda Custom Runtime for Swift with swift-nio 2.0 support
Stars: ✭ 70 (+288.89%)
Mutual labels:  aws-lambda, docker-image
Up Node8
The way this project is packaging the Node 8 app isn't the best. Try the official example of Apex Up that uses the Node binary!
Stars: ✭ 22 (+22.22%)
Mutual labels:  aws-lambda, docker-image
Spilo
Highly available elephant herd: HA PostgreSQL cluster using Docker
Stars: ✭ 776 (+4211.11%)
Mutual labels:  docker-image
Docker Dante Telegram
dante config builder for Telegram SOCKS-proxy & Dockerfile for building image with such proxy
Stars: ✭ 16 (-11.11%)
Mutual labels:  docker-image
Metasfresh
We do Open Source ERP - Fast, Flexible & Free Software to scale your Business.
Stars: ✭ 807 (+4383.33%)
Mutual labels:  docker-image
Aws Lambda Ffmpeg
An S3-triggered Amazon Web Services Lambda function that runs your choice of FFmpeg 🎬 commands on a file 🎥 and uploads the outputs to a bucket.
Stars: ✭ 780 (+4233.33%)
Mutual labels:  aws-lambda
Serverless Plugin Warmup
Keep your lambdas warm during winter. ♨
Stars: ✭ 814 (+4422.22%)
Mutual labels:  aws-lambda
Flannel
flannel is a network fabric for containers, designed for Kubernetes
Stars: ✭ 6,905 (+38261.11%)
Mutual labels:  docker-image
Mpsec
One Stop MPTCP Service : MPSec
Stars: ✭ 18 (+0%)
Mutual labels:  docker-image
Aria2 Pro Docker
Aria2 Pro | A perfect Aria2 Docker image | 更好用的 Aria2 Docker 容器镜像
Stars: ✭ 802 (+4355.56%)
Mutual labels:  docker-image
Aws Lambda Resize Images
AWS Lambda function to generate a set of resized images (large, medium, small)
Stars: ✭ 6 (-66.67%)
Mutual labels:  aws-lambda
Jekyll Docker
⛴ Docker images, and CI builders for Jekyll.
Stars: ✭ 804 (+4366.67%)
Mutual labels:  docker-image
Androidsdk
🐳 Full-fledged Android SDK Docker Image
Stars: ✭ 776 (+4211.11%)
Mutual labels:  docker-image
Docker Postgis
Docker image for PostGIS
Stars: ✭ 821 (+4461.11%)
Mutual labels:  docker-image
Scratch Node
Distroless Node.js Docker Images
Stars: ✭ 778 (+4222.22%)
Mutual labels:  docker-image
Deprecated Patrol Rules Aws
A set of functions implemented using lambda-cfn to monitor an organization's AWS infrastructure for best practices, security and compliance.
Stars: ✭ 16 (-11.11%)
Mutual labels:  aws-lambda
Docker Node
Official Docker Image for Node.js 🐳 🐢 🚀
Stars: ✭ 6,873 (+38083.33%)
Mutual labels:  docker-image
Archive aws Lambda Go Shim
Author your AWS Lambda functions in Go, effectively.
Stars: ✭ 799 (+4338.89%)
Mutual labels:  aws-lambda
Azurite
A lightweight server clone of Azure Storage that simulates most of the commands supported by it with minimal dependencies
Stars: ✭ 810 (+4400%)
Mutual labels:  docker-image
Serverless Aws Lambda Node Postgres
Serverless AWS Lambda with Node.js,Postgres Rest API with Sequelize.
Stars: ✭ 18 (+0%)
Mutual labels:  aws-lambda

Docker image to create Amazon Lambda packages

The usage of this tool changed a lot in April 2020. For the former usage, please check the branch legacy.

Why?

Some node and python modules require a build system because they contain c++ binding. Once deployed, the compiled module may not be compatible with the Amazon Lambda execution environment.

A common solution to this problem is to build the package on an EC2 instance using an Amazon Linux AMI and then to deploy it in Amazon Lambda. Building serverless applications, it is ironic to be forced to use an EC2 server to deploy code.

These docker images are based on the Amazon Linux image and contains libs required to install common python and NodeJS dependencies.

Using myrmex/lambda-packager docker images, you can avoid errors like these during execution in Amazon Lambda:

/var/lang/lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /var/task/node_modules/bcrypt/lib/binding/bcrypt_lib.node)
Module version mismatch. Expected 46, got 48.

Usage

You can use docker volumes to mount the code of the Lambda in a container and retrieve a generated zip archive. The directory where the source files must be mounted is /workspace/sources. The zip archive is generated in the /workspace/package directory in the container.

The generated zip archive can be used as an AWS Lambda deployment package. Check the examples in this repository.

Node.js

The default command of myrmex/lambda-packager:node-12 will install the dependencies defined in the package.json file.

docker run \
    -v `pwd`:/workspace/sources \
    -v /path/to/result/directory:/workspace/package \
    myrmex/lambda-packager:node-12

The archive /path/to/result/directory/package.zip can then be used as a Node.js Lambda package.

Python

The default command of myrmex/lambda-packager:python-3.8 will install the dependencies defined in the requirements.txt file.

docker run \
    -v `pwd`:/workspace/sources \
    -v /path/to/result/directory:/workspace/package \
    myrmex/lambda-packager:python-3.8

The archive /path/to/result/directory/package.zip can then be used as a python Lambda package.

Excluding files from the package

Before installing dependencies, the container copy the source files in a clean directory with rsync.

The environment variable RSYNC_OPTIONS allows to pass options for this rsync command. It is useful to exclude some files from the generated zip archive.

For Node.js the default value of RSYNC_OPTIONS is --exclude node_modules to enforce a clean installation.

For Python the default value of RSYNC_OPTIONS is --exclude venv --exclude .venv to avoid including useless virtual environnement in the zip archive.

example

If one also wants to exclude a docs directory and a README.md file for the generated archive, he can use the following command:

docker run \
    -e RSYNC_OPTIONS="--exclude node_modules --exclude docs --exclude README.md"
    -v `pwd`:/workspace/sources \
    -v /path/to/result/directory:/workspace/package \
    myrmex/lambda-packager:node-12

Working from inside a container

Depending on the context, one may want execute the packaging command from inside the container (eg: in a GitLab pipeline job).

Usage: package-lambda [path-to-sources-dir] [path-to-package-file]

The default value for path-to-sources-dir is /workspace/sources.

The default value for path-to-package-file is /workspace/package/package.zip.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].