akalan

akalan

Docker image for cross-building Elixir/Phoenix apps to CentOS/RHEL

Docker image with Erlang, Elixir, and NodeJS on CentOS for cross-building Elixir/Phoenix apps as OTP releases.

Uses CentOS official base image and official binary
builds of Erlang, Elixir, and NodeJS.

Versions:

  • CentOS: 7.6 (x86-64) - same as RHEL 7.6
  • Erlang: 22.0.4
  • Elixir: 1.9.0
  • NodeJS: 10.16.0

Warning: Do not use this image to deploy the app as the size is quite large at ~598MB

Github | Docker Hub

For an example build file that cross-builds a Phoenix app, refer to phoenix/build-release.sh file.

This file should be placed at the root of the Elixir/Phoenix project and:

# Run the build script inside a container running this image
# Note: On Windows replace $(pwd) with the actual path

docker run -v $(pwd):/home --rm -it akalan/elixir-centos /home/build-release.sh


# Run the generated release inside the same container

docker run -v $(pwd):/home --rm -it akalan/elixir-centos /home/_build/prod/rel/appname/bin/appname

The release is tarred and zipped to releases/appname-version-utc_time_stamp.tar.gz

Most Liked

chulkilee

chulkilee

Quick feedback

General Docker

  • Check the checksum of any downloaded files
  • Clean up cache - e.g. yum update will create caches, so remove all caches in the same RUN - probably it explains the size of the image
  • Leverage layers to maximize caching
    • e.g. changing Elixir version should not invalid layers for erlang

Erlang/Elixir

  • Seems like there is no official repo; then you can just easily build it with src from Releases · erlang/otp · GitHub
  • Precompiled elixir from github release is compiled for the oldest supported OTP, which means you may not leverage the new OTP features :slight_smile:
  • erlang 20.0.4 had a bad bug (ERL-986) - so use the latest version (at least 22.0.5) :slight_smile:

At work, we use Red Hat Universal Base Image - so I created dockerfile for Erlang and Elixir from ubi7 (Red Hat Universal Base Image 7) - check out Chulki Lee / docker-images · GitLab

Where Next?

Popular in Discussions Top

vans163
So useless benchmarks aside, Its possible to write a webserver that can serve 300k requests per second (perhaps more with optimizations)....
New
MarioFlach
Hello, I want to share a project I’ve been working on for a while: https://github.com/almightycouch/gitgud Background Some time ago I ...
New
mmport80
I have put far too much effort into Dialyzer over the last year or so - and basically - I doubt it’s worth the effort. It’s not as easy ...
New
WildYorkies
It seems that the more I read, the more I find Elixir users speaking about all the ways that Elixir is not good for x, y, and z use cases...
New
nunobernardes99
Hi there Elixir friends :vulcan_salute: In a recent task I was on, I needed to check in two dates which of them is the maximum and which...
New
PragTob
Hey everyone, this has been brewing in my head some time and it came up again while reading Adopting Elixir. GenServers, supervisors et...
New
tomekowal
Hey guys! I want to create a toy project that shows a chart of temperature over time and updates every 5 seconds. I feel LiveView is per...
New
AstonJ
Can you believe the first professionally published Elixir book was published just 8 years ago? Since then I think we’ve seen more books f...
New
scouten
I’m looking for a host for the server part of a small (personal) side project that I’m working on. It’s currently written in Node.js and ...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

Other popular topics Top

jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 126479 1222
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement