diff --git a/README.md b/README.md index e4d3a14..5a54c43 100644 --- a/README.md +++ b/README.md @@ -4,32 +4,21 @@ These Dockerfiles are used to build docker images we use for various [Elixir](https://hub.docker.com/r/avvo/elixir/tags/) and [Erlang](https://hub.docker.com/r/avvo/erlang/tags/) containers at Avvo. -## Development +These scripts are only to build erlang and elixir images based on Fedora. +For alpine/ubuntu/debian, please consider [images built by Bob](https://github.com/hexpm/bob#docker-images). -1. Clone this repo -2. Edit the Dockerfile you want to update -3. Keep the primary version number of the image in sync with the Elixir version. - So tag '1.6.2' should be Elixir version 1.6.2. Any changes to the Dockerfile - that are not Elixir version related should increase the letter version. -4. Build and push an image with a version tag - -Calling `push.sh` with no argument will use the directory name as the tag. For -example, the following command will push an `erlang` image with the tags -`20.2.4` and `latest` to Dockerhub: - -``` -cd erlang/20.2.4 -../../push.sh -``` +## Build an image -If an argument is passed to `push.sh`, it will be used as a suffix appended with -a `-` to the current directory name. For example, the following command will -push an `elixir` image with the tags `1.6.2-b` and `latest` to Dockerhub: +1. Clone this repo +2. Run `./push.sh` providing `ELIXIR_VERSION`, `ERLANG_VERSION` and `OS_VERSION` as argiments. +For example: +```bash +./push.sh --elixir=1.11.2 --erlang=23.1.2 --os-version=32 ``` -cd elixir/1.6.2 -../../push.sh b -``` +will build and push to 2 images: + - `avvo/eralng:23.1.2-fedora-32` + - `avvo/elixir:1.11.2-erlang-23.1.2-fedora-32` #### Notes @@ -38,6 +27,52 @@ cd elixir/1.6.2 namespace. 2. Test out your changes on a tag before committing and pushing to latest. +## Multistage Docker Build for Production + +Lower final image size by using multistage docker build and fedora image. + +```Dockerfile +FROM avvo/elixir:1.11.2-erlang-23.1.2-fedora-32 as build + +# install build dependencies +RUN dnf -y update && dnf -y install \ + make automake gcc gcc-c++ kernel-devel \ + git + +# install hex + rebar +RUN mix local.hex --force && \ + mix local.rebar --force + +WORKDIR /srv + +COPY . . + +ENV MIX_ENV=prod + +RUN mix do deps.get --only prod, deps.compile +RUN mix do compile, release + +FROM fedora:32 + +ENV LANG=C.UTF-8 + +RUN set -xe \ + && dnf -y update \ + && dnf -y install \ + ncurses-libs \ + openssl \ + && dnf -y clean all \ + && rm -rf /var/cache/yum + +EXPOSE 4000 + +WORKDIR /srv/app_name + +COPY --from=build ./srv/_build/prod/rel/app_name . + +CMD ["bin/app_name", "start"] +``` + ## License MIT Licence. Do what you want, this is just configuration, nothing special. diff --git a/build-elixir.sh b/build-elixir.sh new file mode 100755 index 0000000..c0c8d22 --- /dev/null +++ b/build-elixir.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -euox pipefail + +elixir=$1 +erlang=$2 +os_version=$3 +os=fedora + +tag=${elixir}-erlang-${erlang}-${os}-${os_version} +erlang_major=$(echo "${erlang}" | awk 'match($0, /^[0-9][0-9]/) { print substr( $0, RSTART, RLENGTH )}') + +dockerfile="elixir-${os}.dockerfile" + +docker build -t avvo/elixir:${tag} --build-arg ELIXIR=${elixir} --build-arg ERLANG=${erlang} --build-arg ERLANG_MAJOR=${erlang_major} --build-arg OS_VERSION=${os_version} -f ${dockerfile} ./ + +echo ${tag} diff --git a/build-erlang.sh b/build-erlang.sh new file mode 100755 index 0000000..e0c7f83 --- /dev/null +++ b/build-erlang.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -euox pipefail + +erlang=$1 +os_version=$2 +os=fedora + +tag=${erlang}-${os}-${os_version} + +dockerfile="erlang-${os}.dockerfile" + +docker build -t avvo/erlang:${tag} --build-arg ERLANG=${erlang} --build-arg OS_VERSION=${os_version} -f ${dockerfile} ./ + +echo ${tag} diff --git a/elixir-circleci/Dockerfile b/elixir-circleci/Dockerfile deleted file mode 100644 index 2efdcc2..0000000 --- a/elixir-circleci/Dockerfile +++ /dev/null @@ -1,49 +0,0 @@ -FROM ubuntu:xenial - -# For latest ERLANG_OTP_VERSION, see: https://packages.erlang-solutions.com/erlang/ -# For latest NODE_VERSION, see: https://github.com/nodesource/distributions/tree/master/deb - -ENV \ - ELIXIR_VERSION='1.5.2-1' \ - ERLANG_OTP_VERSION='20.1.7' \ - HOME='/opt/app/' \ - LANG='C.UTF-8' \ - MIX_ENV='test' \ - NODE_VERSION='8' \ - TERM='xterm' - -WORKDIR "${HOME}" - -RUN \ - set -xe \ - && apt-get update -qq \ - && apt-get upgrade -y \ - && apt-get install -y \ - apt-transport-https \ - build-essential \ - ca-certificates \ - curl \ - git \ - libmysqlclient-dev \ - postgresql-client \ - mysql-client \ - openssh-client \ - software-properties-common \ - && curl -sL "https://deb.nodesource.com/setup_${NODE_VERSION}.x" | bash - \ - && ERLANG_PKG='erlang-solutions_1.0_all.deb' \ - && ERLANG_URL="https://packages.erlang-solutions.com/${ERLANG_PKG}" \ - && curl -o "/tmp/${ERLANG_PKG}" ${ERLANG_URL} \ - && dpkg -i "/tmp/${ERLANG_PKG}" \ - && apt-get update -qq \ - && apt-get upgrade -y \ - && apt-get install -y \ - nodejs \ - "elixir=${ELIXIR_VERSION}" \ - "esl-erlang=1:${ERLANG_OTP_VERSION}" \ - && rm -rf '/var/lib/apt/lists/*' \ - && mix local.hex --force \ - && mix local.rebar --force \ - && mkdir -p '/root/.ssh' \ - && ssh-keyscan -t rsa github.com > '/root/.ssh/known_hosts' \ - && chmod 700 '/root/.ssh' \ - && chmod 600 '/root/.ssh/known_hosts' diff --git a/elixir-fedora.dockerfile b/elixir-fedora.dockerfile new file mode 100644 index 0000000..7d193df --- /dev/null +++ b/elixir-fedora.dockerfile @@ -0,0 +1,25 @@ +# Adapted from: +# https://github.com/hexpm/bob/blob/b0d1aacf386d90ae2a4897ad769b6b074a33b5ae/priv/scripts/docker/elixir-alpine.dockerfile + +ARG ARCH +ARG OS_VERSION +ARG ERLANG + +FROM fedora:${OS_VERSION} AS build + +RUN dnf -y update && dnf -y install \ + wget \ + ca-certificates \ + unzip \ + make + +ARG ELIXIR +ARG ERLANG_MAJOR + +RUN wget -q -O elixir.zip "https://repo.hex.pm/builds/elixir/v${ELIXIR}-otp-${ERLANG_MAJOR}.zip" && unzip -d /ELIXIR elixir.zip +WORKDIR /ELIXIR +RUN make -o compile DESTDIR=/ELIXIR_LOCAL install + +FROM avvo/erlang:${ERLANG}-fedora-${OS_VERSION} AS final + +COPY --from=build /ELIXIR_LOCAL/usr/local /usr/local diff --git a/elixir-release-ubuntu/18.04/Dockerfile b/elixir-release-ubuntu/18.04/Dockerfile deleted file mode 100644 index 7f2f5d1..0000000 --- a/elixir-release-ubuntu/18.04/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM avvo/ubuntu:18.04 - -ENV \ - HOME=/opt/app/ \ - LANG='C.UTF-8' \ - MIX_ENV='prod' \ - TERM='xterm' - -WORKDIR /opt/app - -RUN \ - set -xe \ - && apt-get update \ - && apt-get -y upgrade \ - && apt-get -y install openssl wget mysql-client \ - && rm -rf /var/lib/apt/lists/* diff --git a/elixir-release-ubuntu/xenial/Dockerfile b/elixir-release-ubuntu/xenial/Dockerfile deleted file mode 100644 index 1b273ea..0000000 --- a/elixir-release-ubuntu/xenial/Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -FROM avvo/ubuntu:xenial - -ENV \ - HOME=/opt/app/ \ - LANG='C.UTF-8' \ - MIX_ENV='prod' \ - TERM='xterm' - -WORKDIR /opt/app - -RUN \ - set -xe \ - && apt-get update \ - && apt-get -y upgrade \ - && apt-get -y install openssl wget mysql-client \ - && rm -rf /var/lib/apt/lists/* diff --git a/elixir-release/3.6/Dockerfile b/elixir-release/3.6/Dockerfile deleted file mode 100644 index 6a786ef..0000000 --- a/elixir-release/3.6/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM avvo/alpine:3.6 - -RUN \ - set -xe \ - && apk update \ - && apk upgrade \ - && apk --no-cache --update add \ - libcrypto1.0 \ - libgcc \ - libstdc++ \ - ncurses-libs \ - && rm -rf /var/cache/apk/* diff --git a/elixir/1.6.0/Dockerfile b/elixir/1.6.0/Dockerfile deleted file mode 100644 index 2339743..0000000 --- a/elixir/1.6.0/Dockerfile +++ /dev/null @@ -1,48 +0,0 @@ -FROM avvo/erlang:20-a - -# For latest ERLANG_OTP_VERSION, see: https://packages.erlang-solutions.com/erlang/ -# For latest NODE_VERSION, see: https://github.com/nodesource/distributions/tree/master/deb - -ENV \ - ELIXIR_VERSION='v1.6.0' \ - HOME='/opt/app/' \ - LANG='C.UTF-8' \ - MIX_ENV='test' \ - NODE_VERSION='8' \ - TERM='xterm' - -WORKDIR "${HOME}" - -RUN \ - set -xe \ - && apt-get update -qq \ - && apt-get upgrade -y \ - && apt-get install -y \ - build-essential \ - git \ - libmysqlclient-dev \ - postgresql-client \ - mysql-client \ - software-properties-common \ - && ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/archive/${ELIXIR_VERSION}.tar.gz" \ - && ELIXIR_DOWNLOAD_SHA256="28d93afac480a279b75c3e57ce53fb4c027217c8db55a19d364efe8ceccd1b40" \ - && curl -fSL -o elixir-src.tar.gz $ELIXIR_DOWNLOAD_URL \ - && echo "$ELIXIR_DOWNLOAD_SHA256 elixir-src.tar.gz" | sha256sum -c - \ - && mkdir -p /usr/local/src/elixir \ - && tar -xzC /usr/local/src/elixir --strip-components=1 -f elixir-src.tar.gz \ - && rm elixir-src.tar.gz \ - && cd /usr/local/src/elixir \ - && make install clean \ - && cd $HOME \ - && curl -sL "https://deb.nodesource.com/setup_${NODE_VERSION}.x" | bash - \ - && apt-get update -qq \ - && apt-get upgrade -y \ - && apt-get install -y \ - nodejs \ - && rm -rf '/var/lib/apt/lists/*' \ - && mix local.hex --force \ - && mix local.rebar --force \ - && mkdir -p '/root/.ssh' \ - && ssh-keyscan -t rsa github.com > '/root/.ssh/known_hosts' \ - && chmod 700 '/root/.ssh' \ - && chmod 600 '/root/.ssh/known_hosts' diff --git a/elixir/1.6.1/Dockerfile b/elixir/1.6.1/Dockerfile deleted file mode 100644 index 3ce0b1f..0000000 --- a/elixir/1.6.1/Dockerfile +++ /dev/null @@ -1,48 +0,0 @@ -FROM avvo/erlang:20-a - -# For latest ERLANG_OTP_VERSION, see: https://packages.erlang-solutions.com/erlang/ -# For latest NODE_VERSION, see: https://github.com/nodesource/distributions/tree/master/deb - -ENV \ - ELIXIR_VERSION='v1.6.1' \ - HOME='/opt/app/' \ - LANG='C.UTF-8' \ - MIX_ENV='test' \ - NODE_VERSION='8' \ - TERM='xterm' - -WORKDIR "${HOME}" - -RUN \ - set -xe \ - && apt-get update -qq \ - && apt-get upgrade -y \ - && apt-get install -y \ - build-essential \ - git \ - libmysqlclient-dev \ - postgresql-client \ - mysql-client \ - software-properties-common \ - && ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/archive/${ELIXIR_VERSION}.tar.gz" \ - && ELIXIR_DOWNLOAD_SHA256="91109a1774e9040fb10c1692c146c3e5a102e621e9c48196bfea7b828d54544c" \ - && curl -fSL -o elixir-src.tar.gz $ELIXIR_DOWNLOAD_URL \ - && echo "$ELIXIR_DOWNLOAD_SHA256 elixir-src.tar.gz" | sha256sum -c - \ - && mkdir -p /usr/local/src/elixir \ - && tar -xzC /usr/local/src/elixir --strip-components=1 -f elixir-src.tar.gz \ - && rm elixir-src.tar.gz \ - && cd /usr/local/src/elixir \ - && make install clean \ - && cd $HOME \ - && curl -sL "https://deb.nodesource.com/setup_${NODE_VERSION}.x" | bash - \ - && apt-get update -qq \ - && apt-get upgrade -y \ - && apt-get install -y \ - nodejs \ - && rm -rf '/var/lib/apt/lists/*' \ - && mix local.hex --force \ - && mix local.rebar --force \ - && mkdir -p '/root/.ssh' \ - && ssh-keyscan -t rsa github.com > '/root/.ssh/known_hosts' \ - && chmod 700 '/root/.ssh' \ - && chmod 600 '/root/.ssh/known_hosts' diff --git a/elixir/1.6.2/Dockerfile b/elixir/1.6.2/Dockerfile deleted file mode 100644 index 956dd24..0000000 --- a/elixir/1.6.2/Dockerfile +++ /dev/null @@ -1,48 +0,0 @@ -FROM avvo/erlang:20.2.4-a - -# Adapted from: https://github.com/c0b/docker-elixir/blob/master/1.6/Dockerfile -# For latest NODE_VERSION, see: https://github.com/nodesource/distributions/tree/master/deb - -ENV \ - ELIXIR_VERSION='v1.6.2' \ - ELIXIR_DOWNLOAD_SHA256='64779258e60ddf220fde75c9d972c00ff7760cbd0edbe555c93e3f892f8b0726' \ - NODE_VERSION='9' \ - HOME='/opt/app/' \ - LANG='C.UTF-8' \ - MIX_ENV='test' \ - TERM='xterm' - -WORKDIR "${HOME}" - -RUN \ - set -xe \ - && apt-get update -qq \ - && apt-get upgrade -y \ - && apt-get install -y \ - build-essential \ - git \ - libmysqlclient-dev \ - postgresql-client \ - mysql-client \ - software-properties-common \ - && ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/archive/${ELIXIR_VERSION}.tar.gz" \ - && curl -fSL -o elixir-src.tar.gz "${ELIXIR_DOWNLOAD_URL}" \ - && echo "${ELIXIR_DOWNLOAD_SHA256} elixir-src.tar.gz" | sha256sum -c - \ - && mkdir -p /usr/local/src/elixir \ - && tar -xzC /usr/local/src/elixir --strip-components=1 -f elixir-src.tar.gz \ - && rm elixir-src.tar.gz \ - && cd /usr/local/src/elixir \ - && make install clean \ - && cd "${HOME}" \ - && curl -sL "https://deb.nodesource.com/setup_${NODE_VERSION}.x" | bash - \ - && apt-get update -qq \ - && apt-get upgrade -y \ - && apt-get install -y \ - nodejs \ - && rm -rf '/var/lib/apt/lists/*' \ - && mix local.hex --force \ - && mix local.rebar --force \ - && mkdir -p '/root/.ssh' \ - && ssh-keyscan -t rsa github.com > '/root/.ssh/known_hosts' \ - && chmod 700 '/root/.ssh' \ - && chmod 600 '/root/.ssh/known_hosts' diff --git a/elixir/1.6.3/Dockerfile b/elixir/1.6.3/Dockerfile deleted file mode 100644 index c978bc5..0000000 --- a/elixir/1.6.3/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -FROM avvo/erlang:20.2.4-a - -# Adapted from: -# https://github.com/c0b/docker-elixir/blob/master/1.6/Dockerfile -# -# To get ELIXIR_DOWNLOAD_SHA256, on Mac: -# ELIXIR_VERSION = 'v1.6.3' \ -# ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/archive/${ELIXIR_VERSION}.tar.gz" \ -# curl -fSL "${ELIXIR_DOWNLOAD_URL}" | shasum -a 256 -- -# -# For latest NODE_VERSION, see: https://github.com/nodesource/distributions/tree/master/deb - -ENV \ - ELIXIR_VERSION='v1.6.3' \ - ELIXIR_DOWNLOAD_SHA256='21c249501f4cceeb3c38cbff51afe0bb0623379c3bfd27ee88f8f77eab0dc209' \ - NODE_VERSION='9' \ - HOME='/opt/app/' \ - LANG='C.UTF-8' \ - MIX_ENV='test' \ - TERM='xterm' - -WORKDIR "${HOME}" - -RUN \ - set -xe \ - && apt-get update -qq \ - && apt-get upgrade -y \ - && apt-get install -y \ - build-essential \ - git \ - libmysqlclient-dev \ - postgresql-client \ - mysql-client \ - software-properties-common \ - && ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/archive/${ELIXIR_VERSION}.tar.gz" \ - && curl -fSL -o elixir-src.tar.gz "${ELIXIR_DOWNLOAD_URL}" \ - && echo "${ELIXIR_DOWNLOAD_SHA256} elixir-src.tar.gz" | sha256sum -c - \ - && mkdir -p /usr/local/src/elixir \ - && tar -xzC /usr/local/src/elixir --strip-components=1 -f elixir-src.tar.gz \ - && rm elixir-src.tar.gz \ - && cd /usr/local/src/elixir \ - && make install clean \ - && cd "${HOME}" \ - && curl -sL "https://deb.nodesource.com/setup_${NODE_VERSION}.x" | bash - \ - && apt-get update -qq \ - && apt-get upgrade -y \ - && apt-get install -y \ - nodejs \ - && rm -rf '/var/lib/apt/lists/*' \ - && mix local.hex --force \ - && mix local.rebar --force \ - && mkdir -p '/root/.ssh' \ - && ssh-keyscan -t rsa github.com > '/root/.ssh/known_hosts' \ - && chmod 700 '/root/.ssh' \ - && chmod 600 '/root/.ssh/known_hosts' diff --git a/elixir/1.7.4/Dockerfile b/elixir/1.7.4/Dockerfile deleted file mode 100644 index 92fd57f..0000000 --- a/elixir/1.7.4/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -FROM avvo/erlang:20.2.4-a - -# Adapted from: -# https://github.com/c0b/docker-elixir/blob/master/1.6/Dockerfile -# -# To get ELIXIR_DOWNLOAD_SHA256, on Mac: -# ELIXIR_VERSION = 'v1.6.3' \ -# ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/archive/${ELIXIR_VERSION}.tar.gz" \ -# curl -fSL "${ELIXIR_DOWNLOAD_URL}" | shasum -a 256 -- -# -# For latest NODE_VERSION, see: https://github.com/nodesource/distributions/tree/master/deb - -ENV \ - ELIXIR_VERSION='v1.7.4' \ - ELIXIR_DOWNLOAD_SHA256='c7c87983e03a1dcf20078141a22355e88dadb26b53d3f3f98b9a9268687f9e20' \ - NODE_VERSION='9' \ - HOME='/opt/app/' \ - LANG='C.UTF-8' \ - MIX_ENV='test' \ - TERM='xterm' - -WORKDIR "${HOME}" - -RUN \ - set -xe \ - && apt-get update -qq \ - && apt-get upgrade -y \ - && apt-get install -y \ - build-essential \ - git \ - libmysqlclient-dev \ - postgresql-client \ - mysql-client \ - software-properties-common \ - && ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/archive/${ELIXIR_VERSION}.tar.gz" \ - && curl -fSL -o elixir-src.tar.gz "${ELIXIR_DOWNLOAD_URL}" \ - && echo "${ELIXIR_DOWNLOAD_SHA256} elixir-src.tar.gz" | sha256sum -c - \ - && mkdir -p /usr/local/src/elixir \ - && tar -xzC /usr/local/src/elixir --strip-components=1 -f elixir-src.tar.gz \ - && rm elixir-src.tar.gz \ - && cd /usr/local/src/elixir \ - && make install clean \ - && cd "${HOME}" \ - && curl -sL "https://deb.nodesource.com/setup_${NODE_VERSION}.x" | bash - \ - && apt-get update -qq \ - && apt-get upgrade -y \ - && apt-get install -y \ - nodejs \ - && rm -rf '/var/lib/apt/lists/*' \ - && mix local.hex --force \ - && mix local.rebar --force \ - && mkdir -p '/root/.ssh' \ - && ssh-keyscan -t rsa github.com > '/root/.ssh/known_hosts' \ - && chmod 700 '/root/.ssh' \ - && chmod 600 '/root/.ssh/known_hosts' diff --git a/elixir/1.8.2/Dockerfile b/elixir/1.8.2/Dockerfile deleted file mode 100644 index 91c0fb4..0000000 --- a/elixir/1.8.2/Dockerfile +++ /dev/null @@ -1,53 +0,0 @@ -FROM avvo/erlang:22.1.2 - -# Adapted from: -# https://github.com/c0b/docker-elixir/blob/master/1.8/Dockerfile -# -# For latest NODE_VERSION, see: https://github.com/nodesource/distributions/tree/master/deb - -ENV ELIXIR_VERSION="v1.8.2" \ - LANG=C.UTF-8 - -ENV \ - ELIXIR_VERSION='v1.8.2' \ - ELIXIR_DOWNLOAD_SHA256="cf9bf0b2d92bc4671431e3fe1d1b0a0e5125f1a942cc4fdf7914b74f04efb835" \ - NODE_VERSION='10' \ - HOME='/opt/app/' \ - LANG='C.UTF-8' \ - MIX_ENV='test' \ - TERM='xterm' - -WORKDIR "${HOME}" - -RUN \ - set -xe \ - && apt-get update -qq \ - && apt-get upgrade -y \ - && apt-get install -y \ - build-essential \ - git \ - libmysqlclient-dev \ - postgresql-client \ - mysql-client \ - software-properties-common \ - && ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/archive/${ELIXIR_VERSION}.tar.gz" \ - && curl -fSL -o elixir-src.tar.gz "${ELIXIR_DOWNLOAD_URL}" \ - && echo "${ELIXIR_DOWNLOAD_SHA256} elixir-src.tar.gz" | sha256sum -c - \ - && mkdir -p /usr/local/src/elixir \ - && tar -xzC /usr/local/src/elixir --strip-components=1 -f elixir-src.tar.gz \ - && rm elixir-src.tar.gz \ - && cd /usr/local/src/elixir \ - && make install clean \ - && cd "${HOME}" \ - && curl -sL "https://deb.nodesource.com/setup_${NODE_VERSION}.x" | bash - \ - && apt-get update -qq \ - && apt-get upgrade -y \ - && apt-get install -y \ - nodejs \ - && rm -rf '/var/lib/apt/lists/*' \ - && mix local.hex --force \ - && mix local.rebar --force \ - && mkdir -p '/root/.ssh' \ - && ssh-keyscan -t rsa github.com > '/root/.ssh/known_hosts' \ - && chmod 700 '/root/.ssh' \ - && chmod 600 '/root/.ssh/known_hosts' diff --git a/elixir/1.9.1/Dockerfile b/elixir/1.9.1/Dockerfile deleted file mode 100644 index 2dbcd7a..0000000 --- a/elixir/1.9.1/Dockerfile +++ /dev/null @@ -1,50 +0,0 @@ -FROM avvo/erlang:22.0.7 - -# Adapted from: -# https://github.com/c0b/docker-elixir/blob/master/1.9/Dockerfile -# -# For latest NODE_VERSION, see: https://github.com/nodesource/distributions/tree/master/deb - -ENV \ - ELIXIR_VERSION='v1.9.1' \ - ELIXIR_DOWNLOAD_SHA256="94daa716abbd4493405fb2032514195077ac7bc73dc2999922f13c7d8ea58777" \ - NODE_VERSION='10' \ - HOME='/opt/app/' \ - LANG='C.UTF-8' \ - MIX_ENV='test' \ - TERM='xterm' - -WORKDIR "${HOME}" - -RUN \ - set -xe \ - && apt-get update -qq \ - && apt-get upgrade -y \ - && apt-get install -y \ - build-essential \ - git \ - libmysqlclient-dev \ - postgresql-client \ - mysql-client \ - software-properties-common \ - && ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/archive/${ELIXIR_VERSION}.tar.gz" \ - && curl -fSL -o elixir-src.tar.gz "${ELIXIR_DOWNLOAD_URL}" \ - && echo "${ELIXIR_DOWNLOAD_SHA256} elixir-src.tar.gz" | sha256sum -c - \ - && mkdir -p /usr/local/src/elixir \ - && tar -xzC /usr/local/src/elixir --strip-components=1 -f elixir-src.tar.gz \ - && rm elixir-src.tar.gz \ - && cd /usr/local/src/elixir \ - && make install clean \ - && cd "${HOME}" \ - && curl -sL "https://deb.nodesource.com/setup_${NODE_VERSION}.x" | bash - \ - && apt-get update -qq \ - && apt-get upgrade -y \ - && apt-get install -y \ - nodejs \ - && rm -rf '/var/lib/apt/lists/*' \ - && mix local.hex --force \ - && mix local.rebar --force \ - && mkdir -p '/root/.ssh' \ - && ssh-keyscan -t rsa github.com > '/root/.ssh/known_hosts' \ - && chmod 700 '/root/.ssh' \ - && chmod 600 '/root/.ssh/known_hosts' diff --git a/erlang-fedora.dockerfile b/erlang-fedora.dockerfile new file mode 100644 index 0000000..6d0e996 --- /dev/null +++ b/erlang-fedora.dockerfile @@ -0,0 +1,77 @@ +# Adapted from: +# https://github.com/hexpm/bob/blob/b0d1aacf386d90ae2a4897ad769b6b074a33b5ae/priv/scripts/docker/erlang-alpine.dockerfile + +ARG OS_VERSION + +FROM fedora:${OS_VERSION} AS build + +ARG ERLANG + +RUN dnf -y update +RUN dnf -y install \ + gcc \ + g++ \ + make \ + autoconf \ + ncurses-devel \ + unixODBC-devel \ + $(if [ "${ERLANG:0:1}" = "1" ]; then echo "compat-openssl10"; else echo "openssl-devel"; fi) \ + findutils \ + ca-certificates \ + pax-utils \ + wget + +RUN dnf -y clean all && rm -rf /var/cache/yum + +RUN mkdir /OTP +RUN wget -nv "https://github.com/erlang/otp/archive/OTP-${ERLANG}.tar.gz" && tar -zxf "OTP-${ERLANG}.tar.gz" -C /OTP --strip-components=1 +WORKDIR /OTP +RUN ./otp_build autoconf +RUN ./configure \ + --build="$(dpkg-architecture --query DEB_HOST_GNU_TYPE)" \ + --without-javac \ + --without-wx \ + --without-debugger \ + --without-observer \ + --without-jinterface \ + --without-cosEvent\ + --without-cosEventDomain \ + --without-cosFileTransfer \ + --without-cosNotification \ + --without-cosProperty \ + --without-cosTime \ + --without-cosTransactions \ + --without-et \ + --without-gs \ + --without-ic \ + --without-megaco \ + --without-orber \ + --without-percept \ + --without-typer \ + --with-ssl \ + --enable-threads \ + --enable-dirty-schedulers \ + --disable-hipe +RUN make -j$(getconf _NPROCESSORS_ONLN) +RUN make install +RUN find /usr/local -regex '/usr/local/lib/erlang/\(lib/\|erts-\).*/\(man\|doc\|obj\|c_src\|emacs\|info\|examples\)' | xargs rm -rf +RUN find /usr/local -name src | xargs -r find | grep -v '\.hrl$' | xargs rm -v || true +RUN find /usr/local -name src | xargs -r find | xargs rmdir -vp || true +RUN scanelf --nobanner -E ET_EXEC -BF '%F' --recursive /usr/local | xargs -r strip --strip-all +RUN scanelf --nobanner -E ET_DYN -BF '%F' --recursive /usr/local | xargs -r strip --strip-unneeded + +FROM fedora:${OS_VERSION} AS final + +ARG ERLANG + +RUN dnf -y update \ + && dnf -y install \ + ncurses \ + $(if [ "${ERLANG:0:1}" = "1" ]; then echo "compat-openssl10"; else echo "openssl-devel"; fi) \ + unixODBC \ + lksctp-tools \ + ca-certificates \ + && dnf -y clean all && rm -rf /var/cache/yum + +COPY --from=build /usr/local /usr/local +ENV LANG=C.UTF-8 diff --git a/erlang/20.2.4/Dockerfile b/erlang/20.2.4/Dockerfile deleted file mode 100644 index c30233a..0000000 --- a/erlang/20.2.4/Dockerfile +++ /dev/null @@ -1,85 +0,0 @@ -FROM avvo/ubuntu:xenial - -# Adapted from: https://github.com/c0b/docker-erlang-otp/blob/master/20/Dockerfile - -ENV \ - OTP_VERSION='20.2.4' \ - OTP_DOWNLOAD_SHA256='82072944a1278ff992867b84da7499c64e34e8a853804f4e7a557235308c79d7' \ - REBAR_VERSION='2.6.4' \ - REBAR_DOWNLOAD_SHA256='577246bafa2eb2b2c3f1d0c157408650446884555bf87901508ce71d5cc0bd07' \ - REBAR3_VERSION='3.5.0' \ - REBAR3_DOWNLOAD_SHA256='e95e9d1f2ce219f548d4f49ad41409af02069190f19e2b6717585eef6ee77501' - -# We'll install the build dependencies for erlang-odbc along with the erlang -# build process: -RUN set -xe \ - && OTP_DOWNLOAD_URL="https://github.com/erlang/otp/archive/OTP-${OTP_VERSION}.tar.gz" \ - && runtimeDeps=' \ - apt-transport-https \ - ca-certificates \ - curl \ - libgcrypt11-dev \ - libodbc1 \ - libsctp1 \ - libssl-dev \ - libwxgtk3.0 \ - openssh-client \ - ' \ - && buildDeps=' \ - autoconf \ - build-essential \ - libncurses5-dev \ - libncursesw5-dev \ - libsctp-dev \ - libwxgtk3.0-dev \ - unixodbc-dev \ - ' \ - && apt-get update \ - && apt-get install -y --no-install-recommends ${runtimeDeps} \ - && apt-get install -y --no-install-recommends ${buildDeps} \ - && 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 \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure --build="${gnuArch}" \ - && make -j$(nproc) \ - && make install \ - ) \ - && find /usr/local -name examples | xargs rm -rf \ - && apt-get purge -y --auto-remove ${buildDeps} \ - && rm -rf "${ERL_TOP}" /var/lib/apt/lists/* - -CMD ['erl'] - -# extra useful tools here: rebar & rebar3 - -RUN set -xe \ - && REBAR_DOWNLOAD_URL="https://github.com/rebar/rebar/archive/${REBAR_VERSION}.tar.gz" \ - && 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 - - -RUN set -xe \ - && REBAR3_DOWNLOAD_URL="https://github.com/erlang/rebar3/archive/${REBAR3_VERSION}.tar.gz" \ - && 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/erlang/20.3/Dockerfile b/erlang/20.3/Dockerfile deleted file mode 100644 index b8cc483..0000000 --- a/erlang/20.3/Dockerfile +++ /dev/null @@ -1,85 +0,0 @@ -FROM avvo/ubuntu:xenial - -# Adapted from: https://github.com/c0b/docker-erlang-otp/blob/master/20/Dockerfile - -ENV \ - OTP_VERSION='20.3' \ - OTP_DOWNLOAD_SHA256='e73a9b2c2a16f3739aa642b2a8698c56939e9b0d3664bb92bd9fc51a7308d73e' \ - REBAR_VERSION='2.6.4' \ - REBAR_DOWNLOAD_SHA256='577246bafa2eb2b2c3f1d0c157408650446884555bf87901508ce71d5cc0bd07' \ - REBAR3_VERSION='3.5.0' \ - REBAR3_DOWNLOAD_SHA256='e95e9d1f2ce219f548d4f49ad41409af02069190f19e2b6717585eef6ee77501' - -# We'll install the build dependencies for erlang-odbc along with the erlang -# build process: -RUN set -xe \ - && OTP_DOWNLOAD_URL="https://github.com/erlang/otp/archive/OTP-${OTP_VERSION}.tar.gz" \ - && runtimeDeps=' \ - apt-transport-https \ - ca-certificates \ - curl \ - libgcrypt11-dev \ - libodbc1 \ - libsctp1 \ - libssl-dev \ - libwxgtk3.0 \ - openssh-client \ - ' \ - && buildDeps=' \ - autoconf \ - build-essential \ - libncurses5-dev \ - libncursesw5-dev \ - libsctp-dev \ - libwxgtk3.0-dev \ - unixodbc-dev \ - ' \ - && apt-get update \ - && apt-get install -y --no-install-recommends ${runtimeDeps} \ - && apt-get install -y --no-install-recommends ${buildDeps} \ - && 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 \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure --build="${gnuArch}" \ - && make -j$(nproc) \ - && make install \ - ) \ - && find /usr/local -name examples | xargs rm -rf \ - && apt-get purge -y --auto-remove ${buildDeps} \ - && rm -rf "${ERL_TOP}" /var/lib/apt/lists/* - -CMD ['erl'] - -# extra useful tools here: rebar & rebar3 - -RUN set -xe \ - && REBAR_DOWNLOAD_URL="https://github.com/rebar/rebar/archive/${REBAR_VERSION}.tar.gz" \ - && 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 - - -RUN set -xe \ - && REBAR3_DOWNLOAD_URL="https://github.com/erlang/rebar3/archive/${REBAR3_VERSION}.tar.gz" \ - && 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/erlang/20/Dockerfile b/erlang/20/Dockerfile deleted file mode 100644 index 735851b..0000000 --- a/erlang/20/Dockerfile +++ /dev/null @@ -1,77 +0,0 @@ -FROM avvo/ubuntu:xenial - -ENV OTP_VERSION="20.2.2" - -# We'll install the build dependencies for erlang-odbc along with the erlang -# build process: -RUN set -xe \ - && OTP_DOWNLOAD_URL="https://github.com/erlang/otp/archive/OTP-${OTP_VERSION}.tar.gz" \ - && OTP_DOWNLOAD_SHA256="7614a06964fc5022ea4922603ca4bf1d2cc241f9bd6b7321314f510fd74c7304" \ - && runtimeDeps='libodbc1 \ - apt-transport-https \ - libsctp1 \ - libwxgtk3.0 \ - ca-certificates \ - openssh-client \ - libssl-dev \ - libgcrypt11-dev \ - curl' \ - && buildDeps='unixodbc-dev \ - build-essential \ - libncurses5-dev \ - libncursesw5-dev \ - autoconf \ - libsctp-dev \ - libwxgtk3.0-dev' \ - && apt-get update \ - && apt-get install -y --no-install-recommends $runtimeDeps \ - && apt-get install -y --no-install-recommends $buildDeps \ - && 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 \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure --build="$gnuArch" \ - && make -j$(nproc) \ - && make install ) \ - && find /usr/local -name examples | xargs rm -rf \ - && apt-get purge -y --auto-remove $buildDeps \ - && rm -rf $ERL_TOP /var/lib/apt/lists/* - -CMD ["erl"] - -# extra useful tools here: rebar & rebar3 - -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 - -ENV REBAR3_VERSION="3.4.7" - -RUN set -xe \ - && REBAR3_DOWNLOAD_URL="https://github.com/erlang/rebar3/archive/${REBAR3_VERSION}.tar.gz" \ - && REBAR3_DOWNLOAD_SHA256="19b3d9cddef2e7eefcdf3ca66d1c649847c010edab4e0d2dbfa54161145a3d87" \ - && 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/erlang/22.0.7/Dockerfile b/erlang/22.0.7/Dockerfile deleted file mode 100644 index ff0db2d..0000000 --- a/erlang/22.0.7/Dockerfile +++ /dev/null @@ -1,85 +0,0 @@ -FROM avvo/ubuntu:xenial - -# Adapted from: https://github.com/erlang/docker-erlang-otp/blob/master/22/Dockerfile - -ENV \ - OTP_VERSION="22.0.7" \ - OTP_DOWNLOAD_SHA256="04c090b55ec4a01778e7e1a5b7fdf54012548ca72737965b7aa8c4d7878c92bc" \ - REBAR_VERSION="2.6.4" \ - REBAR_DOWNLOAD_SHA256="577246bafa2eb2b2c3f1d0c157408650446884555bf87901508ce71d5cc0bd07" \ - REBAR3_VERSION="3.11.1" \ - REBAR3_DOWNLOAD_SHA256="a1822db5210b96b5f8ef10e433b22df19c5fc54dfd847bcaab86c65151ce4171" - -# We'll install the build dependencies for erlang-odbc along with the erlang -# build process: -RUN set -xe \ - && OTP_DOWNLOAD_URL="https://github.com/erlang/otp/archive/OTP-${OTP_VERSION}.tar.gz" \ - && runtimeDeps=' \ - apt-transport-https \ - ca-certificates \ - curl \ - libgcrypt11-dev \ - libodbc1 \ - libsctp1 \ - libssl-dev \ - libwxgtk3.0 \ - openssh-client \ - ' \ - && buildDeps=' \ - autoconf \ - build-essential \ - libncurses5-dev \ - libncursesw5-dev \ - unixodbc-dev \ - libsctp-dev \ - libwxgtk3.0-dev \ - ' \ - && apt-get update \ - && apt-get install -y --no-install-recommends $runtimeDeps \ - && apt-get install -y --no-install-recommends $buildDeps \ - && 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 \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure --build="${gnuArch}" \ - && make -j$(nproc) \ - && make install \ - ) \ - && find /usr/local -name examples | xargs rm -rf \ - && apt-get purge -y --auto-remove ${buildDeps} \ - && rm -rf "${ERL_TOP}" /var/lib/apt/lists/* - -CMD ["erl"] - -# extra useful tools here: rebar & rebar3 - -RUN set -xe \ - && REBAR_DOWNLOAD_URL="https://github.com/rebar/rebar/archive/${REBAR_VERSION}.tar.gz" \ - && 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 - - -RUN set -xe \ - && REBAR3_DOWNLOAD_URL="https://github.com/erlang/rebar3/archive/${REBAR3_VERSION}.tar.gz" \ - && 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/erlang/22.1.2/Dockerfile b/erlang/22.1.2/Dockerfile deleted file mode 100644 index c5f7d7b..0000000 --- a/erlang/22.1.2/Dockerfile +++ /dev/null @@ -1,85 +0,0 @@ -FROM avvo/ubuntu:18.04 - -# Adapted from: https://github.com/erlang/docker-erlang-otp/blob/master/22/Dockerfile - -ENV \ - OTP_VERSION="22.1.2" \ - OTP_DOWNLOAD_SHA256="e8ba2c0613f8d505431b86411dd950b91f83f3c4777ce9f03bacb4f76133db4b" \ - REBAR_VERSION="2.6.4" \ - REBAR_DOWNLOAD_SHA256="577246bafa2eb2b2c3f1d0c157408650446884555bf87901508ce71d5cc0bd07" \ - REBAR3_VERSION="3.12.0" \ - REBAR3_DOWNLOAD_SHA256="8ac45498f03e293bc6342ec431888f9a81a4fb9e1177a69965238d127c00a79e" - -# We'll install the build dependencies for erlang-odbc along with the erlang -# build process: -RUN set -xe \ - && OTP_DOWNLOAD_URL="https://github.com/erlang/otp/archive/OTP-${OTP_VERSION}.tar.gz" \ - && runtimeDeps=' \ - apt-transport-https \ - ca-certificates \ - curl \ - libgcrypt11-dev \ - libodbc1 \ - libsctp1 \ - libssl-dev \ - libwxgtk3.0 \ - openssh-client \ - ' \ - && buildDeps=' \ - autoconf \ - build-essential \ - libncurses5-dev \ - libncursesw5-dev \ - unixodbc-dev \ - libsctp-dev \ - libwxgtk3.0-dev \ - ' \ - && apt-get update \ - && apt-get install -y --no-install-recommends $runtimeDeps \ - && apt-get install -y --no-install-recommends $buildDeps \ - && 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 \ - && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ - && ./configure --build="${gnuArch}" \ - && make -j$(nproc) \ - && make install \ - ) \ - && find /usr/local -name examples | xargs rm -rf \ - && apt-get purge -y --auto-remove ${buildDeps} \ - && rm -rf $ERL_TOP /var/lib/apt/lists/* - -CMD ["erl"] - -# extra useful tools here: rebar & rebar3 - -RUN set -xe \ - && REBAR_DOWNLOAD_URL="https://github.com/rebar/rebar/archive/${REBAR_VERSION}.tar.gz" \ - && 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 - - -RUN set -xe \ - && REBAR3_DOWNLOAD_URL="https://github.com/erlang/rebar3/archive/${REBAR3_VERSION}.tar.gz" \ - && 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/push.sh b/push.sh index 6fa5996..3418347 100755 --- a/push.sh +++ b/push.sh @@ -1,12 +1,37 @@ -#!/usr/bin/env bash -set -xe - -IMAGE="avvo/$(basename $(dirname $(pwd)))" -TAG="$(basename $(pwd))" -if [ -n "${1}" ]; then - TAG="${TAG}-${1}" -fi - -docker build -t "${IMAGE}:${TAG}" -t "${IMAGE}:latest" . -docker push "${IMAGE}:${TAG}" -docker push "${IMAGE}:latest" +#!/bin/bash + +for i in "$@" +do +case $i in + --elixir=*) + elixir="${i#*=}" + shift + ;; + --otp=*|--erlang=*) + erlang="${i#*=}" + shift + ;; + --os-version=*) + os_version="${i#*=}" + shift + ;; +esac +done + +erlang_image_tag=$(./build-erlang.sh ${erlang} ${os_version}) +elixir_image_tag=$(./build-elixir.sh ${elixir} ${erlang} ${os_version}) + +try_to_push() { + image=$1 + + # This command have a tendency to intermittently fail + docker push ${image} || + (sleep $((20 + $RANDOM % 40)) && docker push ${image}) || + (sleep $((20 + $RANDOM % 40)) && docker push ${image}) || + (sleep $((20 + $RANDOM % 40)) && docker push ${image}) || + (sleep $((20 + $RANDOM % 40)) && docker push ${image}) || + (exit 0) +} + +try_to_push avvo/erlang:${erlang_image_tag} +try_to_push avvo/elixir:${elixir_image_tag}