-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build(ci): build docker images for each tag, release, push #151
build(ci): build docker images for each tag, release, push #151
Conversation
Next steps
env:
...
BOT_NAME: your-org-bot-name
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
# ... other steps ...
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.BOT_NAME }}
password: ${{ secrets.ORG_GHCR_PAT }}
... In this configuration:
This approach has several advantages:
Remember to give the bot account the necessary permissions in your organization and in the GitHub repository settings so it can push images to GHCR and perform other necessary actions. |
Please look into the failing CI. I just tried to re-run it (with debug logs enabled), but no luck. See here for logs: https://github.com/Security-Tools-Alliance/rengine-ng/actions/runs/10548890515/job/29244740288?pr=151#step:7:4435
|
It should be ok now. |
I didn't find any image on the docker hub, is this only built in CI/CD but not yet published on Docker Hub or elsewhere ? Was this PR rebased ? |
This will only work once it's merged into 2.1.0, and then another PR gets merged to 2.1.0. That should be the case, but we can only test it by merging. I'm reviewing the code now. |
I don't understand this. First you're saying it automatically builds and pushes all images, but then later you say "without pushing".
I'm not a fan of this, because we'll have to maintain the security credentials of that account too:
|
You're right I was certainly tired, I will change this |
Images are not on docker hub but in GitHub Container Registry (GHCR) |
Thanks @psyray as well as @AnonymousWP for the merge and the work on this project ! |
Fix #106
First PoC to automate docker images creation
This need tests
Here are the main modifications and their explanations:
I added triggers for pull requests, pushes to
master
andrelease/**
, tagsv*.*.*
, and published releases.I defined environment variables for the registry, owner, and project name to facilitate maintenance.
I used a matrix to build all images defined in
tasks.json
.I modified the
docker/metadata-action
configuration to generate appropriate tags, including thelatest
tag for the default branch.I adjusted the context and Dockerfile path in
docker/build-push-action
to match your project structure.I added an
update-release
job that runs only when a release is published. This job updates the release description with the list of Docker images built.This configuration will automatically build and push all images to GHCR for each pull request (without pushing), each push to
master
andrelease/**
, eachv*.*.*
tag, and each published release. The images will be tagged with the version number, commit SHA, andlatest
for the default branch.Remember to grant the necessary permissions to the GitHub action to push to GHCR and update releases. You can do this in your GitHub repository settings.