-
Notifications
You must be signed in to change notification settings - Fork 14
Closed
Labels
.NETPull requests that update .NET codePull requests that update .NET codecontainersPull requests that update containers codePull requests that update containers codegithub_actionsPull requests that update GitHub Actions codePull requests that update GitHub Actions code
Description
Description
We want to automate Docker image builds and publish them to GitHub Container Registry (GHCR) on every push to the master branch. This improves traceability, deployment consistency, and aligns with our CI/CD efforts.
Proposed Solution
- Extend our existing GitHub Actions workflow with a new
containerjob. - This job will:
- Log in to GHCR using the
GITHUB_TOKEN. - Build the Docker image from the root
Dockerfile. - Tag the image with
latest,main, and asha-<commit>tag. - Push the image to
ghcr.io/nanotaboada/dotnet-samples-aspnetcore-webapi.
- Log in to GHCR using the
Suggested Implementation
Add a new job to the CI workflow (.github/workflows/dotnet.yml):
container:
needs: coverage
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image to GHCR
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:main
ghcr.io/${{ github.repository }}:sha-${{ github.sha }}Acceptance Criteria
- Docker job runs after
coverage - Image is pushed to GHCR with
latest,main, andsha-<commit>tags - Public package appears under https://github.com/users/nanotaboada/packages
- Any errors during build or push fail the CI pipeline
Metadata
Metadata
Assignees
Labels
.NETPull requests that update .NET codePull requests that update .NET codecontainersPull requests that update containers codePull requests that update containers codegithub_actionsPull requests that update GitHub Actions codePull requests that update GitHub Actions code