Home

Awesome

AWS Lambda Erlang docker

This is used as docker base image for developing AWS Lambda functions running on BEAM.

The goal is to provide images which can be used to build zip packages suitable for deployment as AWS Lambda functions with a provided BEAM runtime.

Please see erllambda for further details on how to run and deploy Erlang AWS Lambda functions.

Usage example

Obtain an image

Pull from official docker hub registry

Simply pull image from docker hub with a required Erlang version:

$ docker pull alertlogic/erllambda:20.3

Build image from sources

To build image locally clone repository:

$ git clone https://github.com/alertlogic/erllambda_docker.git

Specify path to a Dockerfile with a required version to build an image:

$ docker build -t alertlogic/erllambda:20.3 ./erllambda_docker/20

Running

Erlang shell

$ docker run -it --rm alertlogic/erllambda:20.3
Erlang/OTP 20 [erts-9.3.3.5] [source] [64-bit] [smp:3:3] [ds:3:3:10] [async-threads:10] [hipe] [kernel-poll:false]

Eshell V9.3.3.5  (abort with ^G)
1>

Build a package (rebar3_erllambda example)

$ docker run -it --rm -v `pwd`:/buildroot -w /buildroot alertlogic/erllambda:20.3 \
      rebar3 as prod erllambda zip

Design

  1. Erlang images are based on lambci/lambda-base:build image, which replicates the live AWS Lambda environment almost identically.
  2. Erlang OTP is built from source code.
  3. Elixir images are based on alertlogic/erllambda:<version> images.
  4. rebar and rebar3 tools are built from source and bundled in Erlang images.
  5. mix tool is installed from hex and bundled in Elixir images.