cheerfulstoic

cheerfulstoic

Sharing CircleCI configuration / Dockerfile to build, test, and push Elixir Docker images

I spent quite a bit of time trying to find a good configuration to build / test my Elixir app in CircleCI and then push an image to Docker Hub. It is probably a somewhat common thing, but I did a lot of research and trial and error moving around different steps until I got it to a good point. I wanted to share in case in ended up being useful to somebody else searching Google :grin:

Features:

  • Uses Circle CI caching for dependencies / compiled files
  • Runs tests + code checks (using ex_check)
  • Builds and pushes images to Docker Hub:
    • One tag with the Circle CI build number
    • One tag with the git sha
    • One tag with latest (if the current branch is main)
  • A Dockerfile is included which uses Docker’s multi-stage builds and Elixir releases so that the resulting images (for this simple app) ends up around 12.5 MB

I’ve made it available in a GitHub Gist:

Comments welcome here or there

First Post!

dimitarvp

dimitarvp

Thank you for sharing this! I’ll be trying it in the future.

Have you considered making other images not based on Alpine btw? I might try your Dockerfile with Ubuntu 20.04 which is one of the smaller images.

Where Next?

Popular in Guides/Tuts Top

niku
I have published an elixir project with using Travis CI. I would like to share some tips & thoughts that I was getting through this ...
New
hauks96
Hello everyone, I created a deployment tutorial for Phoenix applications with Kubernetes (microk8s) a few months back with the goal of s...
New
New
berts-4865
Here is a quick guide to uploading a file from the browser to DO spaces. It is crude, but will hopefully save sometime time and frustrat...
New
smpallen99
Did you know that IO.inspect/2 returns the the first argument and accepts a label option as a second argument. This makes it a perfect to...
New
WolfDan
So my main OS is Windows, I do must of my work with it, Elixir and vscode elixirls works just fine when you’re working only with elixir, ...
New
1player
A question I had when first learning contexts and Ecto was how to expand the default context API to support more flexible queries. Usuall...
New
dkuku
I Created a blog post about setting up svelte with phoenix. I found it a bit tricky and the only blog post I found was written using som...
New
Jskalc
Sorry if it’s a common knowledge, but it’s something I just learned and wanted to share. I’ve seen that mind-blowing demo of hot-reload ...
New
kevinlang
Hey all, With Phoenix 1.6 just around the corner, I figured I’d make a tutorial on how to add Bulma to a new Phoenix 1.6 project. By lev...
New

Other popular topics Top

peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
William
I would like to know that is there any online source for learning Phoenix Framework for building E-Commerce Store? Any advantage on build...
New
sergio
I couldn’t find any guides that worked well with Phoenix 1.6.0 and esbuild. I hope this helps people test the waters and eases you into t...
New
AstonJ
You’re a programmer, so you don’t need spoon feeding with the conventional drivel about “this is an integer.” No. You need to know what’s...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 42633 214
New
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> someth...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New

We're in Beta

About us Mission Statement