diff --git a/.travis.yml b/.travis.yml index 433128b..4129704 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,6 @@ services: docker env: - DIR=21 - - DIR=20 - DIR=elixir install: @@ -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: diff --git a/20/Dockerfile b/20/Dockerfile deleted file mode 100644 index 90f7a97..0000000 --- a/20/Dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -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="20.3.8.11" - -RUN set -e \ - && OTP_DOWNLOAD_URL="https://github.com/erlang/otp/archive/OTP-${OTP_VERSION}.tar.gz" \ - && OTP_DOWNLOAD_SHA256="76fdb88a693e406efb5a484f87cfad50c5cabab932151e4f2e5ff59d2405ee40" \ - && 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 \ - && ./otp_build autoconf \ - && ./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.6.2" - -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 \ - && HOME=$PWD ./bootstrap \ - && install -v ./rebar3 /usr/local/bin/ \ - && rm -rf /usr/src/rebar3-src diff --git a/21/Dockerfile b/21/Dockerfile index 8b1d07a..25de221 100644 --- a/21/Dockerfile +++ b/21/Dockerfile @@ -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" \ && 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 \ @@ -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 \ diff --git a/README.md b/README.md index 9ec7118..69c41ca 100644 --- a/README.md +++ b/README.md @@ -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 @@ -32,7 +32,8 @@ $ 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 @@ -40,17 +41,17 @@ $ docker build -t alertlogic/erllambda:20.3 ./erllambda_docker/20 #### 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 ``` diff --git a/elixir/Dockerfile b/elixir/Dockerfile index 166d4ab..a434fd2 100644 --- a/elixir/Dockerfile +++ b/elixir/Dockerfile @@ -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 \ @@ -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 \ diff --git a/makefile b/makefile new file mode 100644 index 0000000..306f771 --- /dev/null +++ b/makefile @@ -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