Example Dockerfile for Phoenix umbrella using Elixir 1.9 Releases

Fair warning, I’m a n00b to everything that is Elixir and Docker (so of course I want to do both at once, but let’s ignore that for a sec).

I would like to practice deploys with a Phoenix umbrella and Docker to a cloud platform like AWS or GCP. I have been using this as a base Dockerfile (https://hexdocs.pm/phoenix/releases.html#containers) and expanding/adding to it. It’s starting to get pretty hacky as I don’t consider myself a Docker expert and I have to overcome errors with every new step in the build process.

There are examples of Dockerfiles for Phoenix umbrellas but they don’t use the new Elixir 1.9 releases.

Are there any examples anywhere of a production ready (explaining DATABASE_URL, SECRET_KEY_BASE, etc…) Dockerfile for a Phoenix umbrella (with app_name/assets, not just api)? Also, it would be great if there was an explanation around each step discussing why this step is needed.

Thank you :pray:

PS: reading through the forum it seems there’s a lot of discussion around deployment, it would be great if there was more consensus around the topic, or at least some templates to get us n00bs started. Maybe deployment scripts for some common/popular scenarios. Every deploy is different but it would be nice if there was a stock (it just works) example that people can begin to learn from.

PPS: when a n00b gets an answer that’s along the lines of “it depends” it becomes a blocker. Opinions are great! I’d love to hear more of them :sweat_smile:

I have a pretty simple setup for my umbrella project.

Dockerfile:

mix.exs:

You will actually have to move the SecretsManagerProvider dep into one of the applications under apps, whichever one you’re building the release for.

I use SecretsManagerProvider to load all of my runtime configurations from AWS Secrets Manager.

3 Likes