Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce OTP 24 and Elixir 1.12 #1

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ This is used as docker base image for developing [AWS Lambda](https://aws.amazon
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](https://github.com/alertlogic/erllambda) for further details on how to
run and deploy Erlang AWS Lambda functions.
Please see [erllambda](https://github.com/alertlogic/erllambda) source repository
for further details on how to run and deploy Erlang AWS Lambda functions.

## Usage example

Expand All @@ -18,32 +18,32 @@ run and deploy Erlang AWS Lambda functions.
Simply pull image from docker hub with a required Erlang version:

``` console
$ docker pull alertlogic/erllambda:20.3
$ docker pull sourcelevel/erllambda:24.2
```

#### Build image from sources

To build image locally clone repository:

```console
$ git clone https://github.com/alertlogic/erllambda_docker.git
$ git clone https://github.com/sourcelevel/erllambda_docker.git
```

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

``` console
$ docker build -t alertlogic/erllambda:20.3 ./erllambda_docker/20
$ docker build -t sourcelevel/erllambda:24.2 ./erlang/24/
```

### Running

#### Erlang shell

```console
$ 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]
$ docker run -it --rm sourcelevel/erllambda:24.2
Erlang/OTP 24 [erts-12.2.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1]

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

Expand Down
29 changes: 29 additions & 0 deletions elixir/1.12/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM sourcelevel/erllambda:24.2

ARG ELIXIR_VERSION=1.12.3

ENV LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8 \
LC_ALL=en_US.UTF-8

ENV MIX_REBAR3=/usr/local/bin/rebar3
ENV MIX_REBAR=/usr/local/bin/rebar

RUN set -xe \
&& ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/archive/v${ELIXIR_VERSION}.tar.gz" \
&& ELIXIR_DOWNLOAD_SHA256=c5affa97defafa1fd89c81656464d61da8f76ccfec2ea80c8a528decd5cb04ad \
&& curl -fsSL $ELIXIR_DOWNLOAD_URL -o elixir-src.tar.gz \
&& echo "$ELIXIR_DOWNLOAD_SHA256 elixir-src.tar.gz" | sha256sum -c - \
&& mkdir -p /usr/src/elixir-src \
&& tar -xzf elixir-src.tar.gz -C /usr/src/elixir-src --strip-components=1 \
&& rm elixir-src.tar.gz \
&& cd /usr/src/elixir-src \
&& make -j$(nproc) \
&& make install \
&& rm -rf /usr/src/elixir-src \
&& cd $HOME \
&& mix local.hex --force \
&& mix hex.info

CMD ["iex"]

File renamed without changes.
File renamed without changes.
File renamed without changes.
55 changes: 55 additions & 0 deletions erlang/24/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
FROM lambci/lambda-base:build

# install build dependencies, not provided by lambda-base:build image
RUN set -e \
&& yum -y install \
ncurses-devel

ARG OTP_VERSION="24.2.2"

RUN set -e \
&& OTP_DOWNLOAD_URL="https://github.com/erlang/otp/archive/OTP-${OTP_VERSION}.tar.gz" \
&& OTP_DOWNLOAD_SHA256="b6adfc0bf14d94348146ae26cc38d09dca545f8e14ebab7ddcf9482a6e8d1162" \
&& curl -fSL -o otp-src.tar.gz "$OTP_DOWNLOAD_URL" \
&& echo "$OTP_DOWNLOAD_SHA256 otp-src.tar.gz" | sha256sum -c - \
&& export ERL_TOP="/usr/src/otp_src_${OTP_VERSION%%@*}" \
&& mkdir -vp $ERL_TOP \
&& tar -xzf otp-src.tar.gz -C $ERL_TOP --strip-components=1 \
&& rm otp-src.tar.gz \
&& ( cd $ERL_TOP \
&& ./configure \
&& make -j$(nproc) \
&& make install ) \
&& find /usr/local -name examples | xargs rm -rf

CMD ["erl"]

ENV REBAR_VERSION="2.6.4"

RUN set -xe \
&& REBAR_DOWNLOAD_URL="https://github.com/rebar/rebar/archive/${REBAR_VERSION}.tar.gz" \
&& REBAR_DOWNLOAD_SHA256="577246bafa2eb2b2c3f1d0c157408650446884555bf87901508ce71d5cc0bd07" \
&& mkdir -p /usr/src/rebar-src \
&& curl -fSL -o rebar-src.tar.gz "$REBAR_DOWNLOAD_URL" \
&& echo "$REBAR_DOWNLOAD_SHA256 rebar-src.tar.gz" | sha256sum -c - \
&& tar -xzf rebar-src.tar.gz -C /usr/src/rebar-src --strip-components=1 \
&& rm rebar-src.tar.gz \
&& cd /usr/src/rebar-src \
&& ./bootstrap \
&& install -v ./rebar /usr/local/bin/ \
&& rm -rf /usr/src/rebar-src

ARG REBAR3_VERSION="3.20.0"

RUN set -xe \
&& REBAR3_DOWNLOAD_URL="https://github.com/erlang/rebar3/archive/${REBAR3_VERSION}.tar.gz" \
&& REBAR3_DOWNLOAD_SHA256="53ed7f294a8b8fb4d7d75988c69194943831c104d39832a1fa30307b1a8593de" \
&& mkdir -p /usr/src/rebar3-src \
&& curl -fSL -o rebar3-src.tar.gz "$REBAR3_DOWNLOAD_URL" \
&& echo "$REBAR3_DOWNLOAD_SHA256 rebar3-src.tar.gz" | sha256sum -c - \
&& tar -xzf rebar3-src.tar.gz -C /usr/src/rebar3-src --strip-components=1 \
&& rm rebar3-src.tar.gz \
&& cd /usr/src/rebar3-src \
&& HOME=$PWD ./bootstrap \
&& install -v ./rebar3 /usr/local/bin/ \
&& rm -rf /usr/src/rebar3-src