-
Notifications
You must be signed in to change notification settings - Fork 0
feat(ci): improve Docker workflow with Buildx, caching and semver tags #3
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,26 +1,35 @@ | ||||||||
| name: Docker | ||||||||
| name: Build and Publish Docker Image | ||||||||
|
|
||||||||
| on: | ||||||||
| push: | ||||||||
| branches: [main] | ||||||||
| branches: | ||||||||
| - main | ||||||||
| tags: | ||||||||
| - "v*" | ||||||||
| pull_request: | ||||||||
| branches: | ||||||||
| - main | ||||||||
|
|
||||||||
| env: | ||||||||
| REGISTRY: ghcr.io | ||||||||
| IMAGE_NAME: ${{ github.repository }} | ||||||||
|
|
||||||||
| jobs: | ||||||||
| build-and-push: | ||||||||
| name: Build & Push Docker Image | ||||||||
| runs-on: ubuntu-latest | ||||||||
| permissions: | ||||||||
| contents: read | ||||||||
| packages: write | ||||||||
|
|
||||||||
| steps: | ||||||||
| - name: Checkout code | ||||||||
| - name: Checkout repository | ||||||||
| uses: actions/checkout@v4 | ||||||||
|
|
||||||||
| - name: Set up Docker Buildx | ||||||||
| uses: docker/setup-buildx-action@v3 | ||||||||
|
|
||||||||
| - name: Log in to Container Registry | ||||||||
| if: github.event_name != 'pull_request' | ||||||||
| uses: docker/login-action@v3 | ||||||||
| with: | ||||||||
| registry: ${{ env.REGISTRY }} | ||||||||
|
|
@@ -33,13 +42,18 @@ jobs: | |||||||
| with: | ||||||||
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||||||||
| tags: | | ||||||||
| type=raw,value=latest | ||||||||
| type=ref,event=branch | ||||||||
| type=ref,event=pr | ||||||||
| type=semver,pattern={{version}} | ||||||||
| type=semver,pattern={{major}}.{{minor}} | ||||||||
|
||||||||
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=raw,value=latest,enable={{is_default_branch}} |
Copilot
AI
Dec 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SHA tag format uses an empty prefix (prefix=), which will result in tags that are just the raw SHA (e.g., abc123 instead of sha-abc123). This could be confusing as it's unclear what the tag represents. Consider using the default sha- prefix by removing the prefix= parameter, or use a more descriptive prefix to make it clear these are commit SHA tags.
| type=sha,prefix= | |
| type=sha |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The semver tagging configuration is missing the
type=semver,pattern={{major}}pattern. Without this, major version tags (e.g.,v1) won't be created, which is a common practice for allowing users to pin to major versions. Consider adding this pattern to provide more flexibility for consumers of the image.