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

update versions of erlang and base image #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ services: docker

env:
- DIR=21
- DIR=20
- DIR=elixir

install:
Expand All @@ -13,7 +12,7 @@ before_script:
- cd "$DIR"

script:
- docker build --pull -t "$DIR" .
- docker buildx build --platform linux/amd64,linux/arm64 --pull -t "$DIR" .
- ~/official-images/test/run.sh "$DIR"

after_script:
Expand Down
56 changes: 0 additions & 56 deletions 20/Dockerfile

This file was deleted.

39 changes: 15 additions & 24 deletions 21/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
FROM lambci/lambda-base:build
FROM public.ecr.aws/lambda/provided:al2
# AWS Linux2 provided runtime

# install build dependencies, not provided by lambda-base:build image
RUN set -e \
&& yum -y install \
ncurses-devel
&& yum -y install \
tar gzip ncurses-devel \
binutils autoconf automake make \
gcc10 gcc10-c++ \
openssl \
openssl-devel \
&& yum clean all \
&& rm -rf /var/cache/yum

ARG OTP_VERSION="21.1.1"
ENV CC gcc10-gcc
ENV CXX gcc10-g++

ARG OTP_VERSION="21.3.8.21"

RUN set -e \
&& OTP_DOWNLOAD_URL="https://github.com/erlang/otp/archive/OTP-${OTP_VERSION}.tar.gz" \
&& OTP_DOWNLOAD_SHA256="a6588243e9659960e184083f49b15ea37890e4cd9bb8aef84ba4180db68befc3" \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no SHA for me? ;(

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll trust it's not spoofed.

&& 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 \
Expand All @@ -25,29 +33,12 @@ RUN set -e \

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.6.2"
ARG REBAR3_VERSION="3.13.3"

RUN set -xe \
&& REBAR3_DOWNLOAD_URL="https://github.com/erlang/rebar3/archive/${REBAR3_VERSION}.tar.gz" \
&& REBAR3_DOWNLOAD_SHA256="7f358170025b54301bce9a10ec7ad07d4e88a80eaa7b977b73b32b45ea0b626e" \
&& 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 \
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ 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 alertlogic/erllambda:21.3
```

#### Build image from sources
Expand All @@ -32,25 +32,26 @@ $ git clone https://github.com/alertlogic/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 buildx build --platform linux/amd64,linux/arm64 -t alertlogic/erllambda:21.3 ./21 --push
$ docker buildx build --platform linux/amd64,linux/arm64 -t alertlogic/erllambda:21.3-elixir ./elixir --push
```

### 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 alertlogic/erllambda:21.3
Erlang/OTP 21 [erts-10.3.5.16] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1]

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

#### Build a package ([rebar3_erllambda](https://github.com/alertlogic/rebar3_erllambda) example)

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

Expand Down
4 changes: 1 addition & 3 deletions elixir/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alertlogic/erllambda:20.3
FROM alertlogic/erllambda:21.3

ARG ELIXIR_VERSION=1.7.4
ENV LANG=en_US.UTF-8 \
Expand All @@ -10,9 +10,7 @@ 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=c7c87983e03a1dcf20078141a22355e88dadb26b53d3f3f98b9a9268687f9e20 \
&& 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 \
Expand Down
17 changes: 17 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
REV=$(shell git describe)

ORG := alertlogic
BASE := erllambda
BASE_LABEL := 21.3
ELIXIR_LABEL := 21.3-elixir

REGIONS=("us-east-1" "us-west-2" "eu-west-1" "eu-west-2")

all: base-image

base-image:
docker buildx build --platform linux/amd64,linux/arm64 -t $(ORG)/$(BASE):$(MULTI_LABEL) ./21 --push

elixir-image:
docker buildx build --platform linux/amd64,linux/arm64 -t $(ORG)/$(BASE):$(ELIXIR_LABEL) ./elixir --push