Skip to main content

Try out your code on the latest OTP and Elixir

·2 mins

TL;DR: If you want an easy way to run the latest version of elixir (an the latest version of OTP) and you have docker installed, do this:

docker pull leifg/elixir:edge
docker run --rm -it leifg/elixir:edge iex

Elixir Docker Builds #

A while ago I started building my custom Elixir Docker image using Github and Docker hub automated builds.

I tagged the Elixir versions I wanted to build to create a 1.x and 1.x.y tag on Docker Hub. In addition the master branch would be tagged with latest. I always used the latest stable OTP to reduce complexity.

This was working fine and I was using these images for various projects.

Edge Builds #

Then came the time when I actually wanted to try out code with the latest Elixir (and OTP) version.

So I created a stable branch. On this branch the only Docker builds that happen are based on tags.

The master branch is then exclusively used for edge builds. Meaning: Erlang/OTP master and Elixir master will be built as soon as a build is triggered on Docker hub.

Automatic Builds #

At this point builds on Docker hub were only triggered when the configured repository (in my case leifg/docker-elixir) is updated.

But I wanted to have a new image whenever something in Elixir or Erlang/OTP master changes.

Luckily Docker hub provides a feature called remote build triggers.

I ended up utilizing Zapier using the Github Trigger and the Webhook Action to start a new build on Docker hub every time a commit on Elixir (or Erlang/OTP) master happens.

Bottom line #

Unfortunately the docker builds take quite long (~30 min) and Zapier only triggers POST requests only every 15 minutes (at least in my tier).

But nevertheless: ~1h after a commit on these 2 repos you are able to play around with the built version.

docker pull leifg/elixir:edge
docker run --rm -it leifg/elixir:edge iex

If unsure which commit you are using have a look in the info.txt file in the root directory:

docker run --rm -it leifg/elixir:edge cat /info.txt