Skip to content
Open
52 changes: 44 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ These Dockerfiles are used to build docker images we use for various

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.
3. Keep the primary version number of the image in sync with the Elixir version and its base erlang/otp 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.
that are not Elixir version or base image 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:
`22.1.3-alpine` and `alpine-latest` to Dockerhub:

```
cd erlang/20.2.4
../../push.sh
cd erlang/22.1.3/alpine
../../../push.sh
```

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:
push an `elixir` image with the tags `1.9.2-alpine-otp22` and `alpine-latest` to Dockerhub:

```
cd elixir/1.6.2
../../push.sh b
cd elixir/1.9.2/alpine
../../../push.sh otp22
```

#### Notes
Expand All @@ -38,6 +38,42 @@ 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 avvo/alpine image.

```Dockerfile
FROM avvo/elixir:1.9.4-otp22-alpine-3.9 AS build

ENV MIX_ENV=prod

COPY . .

# If you have assets to build
RUN cd assets \
&& npm install \
&& npm run deploy \
&& cd ../

RUN mix phx.digest

RUN mix do deps.get, compile, release

FROM avvo/elixir-release:alpine-3.9

EXPOSE 4000

WORKDIR /srv/app_name

COPY --from=build ./_build/prod/app_name-APP_VERSION.tar.gz .

RUN tar zxf app_name-APP_VERSION.tar.gz \
&& rm app_name-APP_VERSION.tar.gz

ENTRYPOINT ["avvoenv", "exec"]
CMD ["bin/app_name", "start"]
```

## License

MIT Licence. Do what you want, this is just configuration, nothing special.
49 changes: 0 additions & 49 deletions elixir-circleci/Dockerfile

This file was deleted.

File renamed without changes.
7 changes: 7 additions & 0 deletions elixir-release/alpine/3.9/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM avvo/alpine:3.9

RUN set -xe \
&& apk --no-cache upgrade \
&& apk add --no-cache \
ncurses-libs \
openssl
34 changes: 34 additions & 0 deletions elixir/1.10.2/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM avvo/erlang:22-alpine-11

# Adapted from:
# https://github.com/c0b/docker-elixir/blob/master/1.9/Dockerfile

# elixir expects utf8.
ENV ELIXIR_VERSION="v1.10.2" \
LANG=C.UTF-8

RUN set -xe \
&& ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/archive/${ELIXIR_VERSION}.tar.gz" \
&& ELIXIR_DOWNLOAD_SHA256="5adffcf4389aa82fcfbc84324ebbfa095fc657a0e15b2b055fc05184f96b2d50" \
&& buildDeps=' \
ca-certificates \
curl \
make \
' \
&& apk --no-cache upgrade \
&& apk add --no-cache --virtual .build-deps $buildDeps \
&& 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 \
&& apk del .build-deps \
&& mix local.hex --force \
&& mix local.rebar --force \
&& mkdir -p '/root/.ssh' \
&& apk add --no-cache openssh-client build-base npm git \
&& ssh-keyscan -t rsa github.com > '/root/.ssh/known_hosts' \
&& chmod 700 '/root/.ssh' \
&& chmod 600 '/root/.ssh/known_hosts'
34 changes: 34 additions & 0 deletions elixir/1.10.4/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM avvo/erlang:23.0.2-alpine

# Adapted from:
# https://github.com/c0b/docker-elixir/blob/master/1.10/alpine/Dockerfile

# elixir expects utf8.
ENV ELIXIR_VERSION="v1.10.4" \
LANG=C.UTF-8

RUN set -xe \
&& ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/archive/${ELIXIR_VERSION}.tar.gz" \
&& ELIXIR_DOWNLOAD_SHA256="8518c78f43fe36315dbe0d623823c2c1b7a025c114f3f4adbb48e04ef63f1d9f" \
&& buildDeps=' \
ca-certificates \
curl \
make \
' \
&& apk --no-cache upgrade \
&& apk add --no-cache --virtual .build-deps $buildDeps \
&& 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 \
&& apk del .build-deps \
&& mix local.hex --force \
&& mix local.rebar --force \
&& mkdir -p '/root/.ssh' \
&& apk add --no-cache openssh-client build-base npm git \
&& ssh-keyscan -t rsa github.com > '/root/.ssh/known_hosts' \
&& chmod 700 '/root/.ssh' \
&& chmod 600 '/root/.ssh/known_hosts'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
36 changes: 36 additions & 0 deletions elixir/1.9.2/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM avvo/erlang:22-alpine

# Adapted from:
# https://github.com/c0b/docker-elixir/blob/master/1.9/Dockerfile

# elixir expects utf8.
ENV ELIXIR_VERSION="v1.9.2" \
LANG=C.UTF-8 \
MIX_ENV='test'

RUN set -xe \
&& STARTING_DIR="$(pwd)" \
&& ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/archive/${ELIXIR_VERSION}.tar.gz" \
&& ELIXIR_DOWNLOAD_SHA256="02aaa3ffd21f9cf51aceb3aa5a5bc2c1e2636b1611867e44f19693dcf856e25c" \
&& buildDeps=' \
ca-certificates \
curl \
make \
' \
&& apk --no-cache upgrade \
&& apk add --no-cache --virtual .build-deps $buildDeps \
&& 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 \
&& apk del .build-deps \
&& mix local.hex --force \
&& mix local.rebar --force \
&& mkdir -p '/root/.ssh' \
&& apk add --no-cache openssh-client build-base npm git \
&& ssh-keyscan -t rsa github.com > '/root/.ssh/known_hosts' \
&& chmod 700 '/root/.ssh' \
&& chmod 600 '/root/.ssh/known_hosts'
36 changes: 36 additions & 0 deletions elixir/1.9.4/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM avvo/erlang:22-alpine

# Adapted from:
# https://github.com/c0b/docker-elixir/blob/master/1.9/Dockerfile

# elixir expects utf8.
ENV ELIXIR_VERSION="v1.9.4" \
LANG=C.UTF-8 \
MIX_ENV='test'

RUN set -xe \
&& STARTING_DIR="$(pwd)" \
&& ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/archive/${ELIXIR_VERSION}.tar.gz" \
&& ELIXIR_DOWNLOAD_SHA256="f3465d8a8e386f3e74831bf9594ee39e6dfde6aa430fe9260844cfe46aa10139" \
&& buildDeps=' \
ca-certificates \
curl \
make \
' \
&& apk --no-cache upgrade \
&& apk add --no-cache --virtual .build-deps $buildDeps \
&& 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 \
&& apk del .build-deps \
&& mix local.hex --force \
&& mix local.rebar --force \
&& mkdir -p '/root/.ssh' \
&& apk add --no-cache openssh-client build-base npm git \
&& ssh-keyscan -t rsa github.com > '/root/.ssh/known_hosts' \
&& chmod 700 '/root/.ssh' \
&& chmod 600 '/root/.ssh/known_hosts'
File renamed without changes.
File renamed without changes.
File renamed without changes.
85 changes: 0 additions & 85 deletions erlang/22.0.7/Dockerfile

This file was deleted.

File renamed without changes.
Loading