This repository builds a custom Docker image based on the official Grafana Alloy image, injecting your own configuration, and pushes it to GitHub Container Registry (GHCR).
- The Dockerfile uses the official Alloy image as a base and copies in your custom configuration.
- A GitHub Actions workflow checks for new releases of the official Alloy image (on push to main, on a schedule, or manually).
- If a new version is found, it automatically builds and pushes a new image with your configuration to GHCR.
The workflow runs on:
- Pushes to the
mainbranch - A daily schedule (6am UTC)
- Manual dispatch via the GitHub Actions UI
- Fetch latest upstream tag:
- Uses a shell step with
curlandjqto fetch the latest stable tag from Docker Hub forgrafana/alloy.
- Uses a shell step with
- Compare with last built tag:
- If the tag is new, proceeds to build and push.
- Log in to GHCR:
- Uses
docker/login-actionto authenticate to GitHub Container Registry with the built-inGITHUB_TOKEN.
- Uses
- Build and push:
- Uses
docker/build-push-actionto build the image with the correct base tag and push toghcr.io/<owner>/alloy-custom:<tag>.
- Uses
- Update last built tag:
- Stores the last built tag in
.last_built_tagand commits it to the repository.
- Stores the last built tag in
- Place your Alloy configuration in
alloy-config.yaml. - The image will be built and published to GHCR as
ghcr.io/<your-org-or-username>/alloy-custom:<upstream-tag>.
To build and run locally:
docker build --build-arg ALLOY_TAG=<tag> -t my-alloy:local .
docker run --rm -it my-alloy:local- The workflow is defined in
.github/workflows/rebuild-on-upstream.yml. - It uses:
- A shell step to fetch the latest upstream tag with
curlandjq. - docker/login-action for GHCR authentication.
- docker/build-push-action to build and push the image.
- stefanzweifel/git-auto-commit-action to update the last built tag.
- A shell step to fetch the latest upstream tag with
- Edit
alloy-config.yamlto change the configuration. - Edit the Dockerfile if you need to change the config path or add more files.
MIT