A repository showcasing using Renovate on an Elixir project (here a Phoenix app deployed to Fly.io).
Renovate is a highly-configurable dependency management bot that automates update PRs.
Despite being written in JavaScript, it runs as a GitHub app (there's also self-hosting options), and is able to manage the dependencies for a lot of languages and tools.
- Automatically updates the
hexpm/elixir
Docker base image tag (for Fly) - Keeps Elixir/OTP versions in sync between
asdf
(.tool-versions
) and production Docker
- chore(deps): update dependency elixir to v1.17.0 (#9)
- chore(deps): update dependency erlang to v27 (#10)
- chore(deps): update debian docker tag to bullseye-20240612-slim (#12)
- We use version comments in
Dockerfile
to tell Renovate where to find the version information for each part of the image (Debian, OTP & Elixir) - We setup a "Test Docker Build" CI workflow that makes sure the image tag composed from those three versions actually exist (so Renovate doesn't auto-merge an inexistant image, if auto-merge is enabled in the first place)
- We add the
regexManagers:dockerfileVersions
preset and a few package rules for the Debian versioning - That's it :)
When merging update PRs for each component, I find it's best to merge them in this order: Debian > OTP > Elixir.
- Copy
.github/renovate.json5
to your.github/
directory - Copy
.github/workflows/test-docker-build.yml
to your.github/workflows/
directory - Add the version comments and
base
build stage inDockerfile
- Pick what you want / customize to your liking. You might also want to copy the rules from my base preset directly in your config
- Install Renovate to your repository
- Profit!
- The "Test Docker Build" workflow targets the
base
build stage to only test base image existence. The rationale behind this choice is to reduce feedback cycles and cost less Action credits (in this repository the full build is only ~1 min, but once your application grows it can increase significantly). If you want to test the full image build, change the target tobuilder
instead.
If you're interested in automating your Elixir workflows, don't hesitate to reach out, I'll be glad to give a hand!
- X (formerly Twitter):
@_sheerlox
- Discord:
sheerlox
- Renovate documentation
- Renovate developer portal: a place to monitor its activity on your repo and view logs.
- How should you pin dependencies and why?: although it's for JS, I believe it is an interesting read for Elixir as well.