Skip to content

Instantly share code, notes, and snippets.

@BrunoGrandePhD
Created March 13, 2023 21:20
Show Gist options
  • Save BrunoGrandePhD/3e85dfb0eca57df470e20085f9e15272 to your computer and use it in GitHub Desktop.
Save BrunoGrandePhD/3e85dfb0eca57df470e20085f9e15272 to your computer and use it in GitHub Desktop.
name: docker-ci
on:
push:
branches: [main]
tags: ['v[0-9]*', '[0-9]+.[0-9]+*'] # Match tags that resemble a version
workflow_dispatch: # Allow manually triggering the workflow
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v4
id: meta
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=ref,event=branch
type=sha
- uses: docker/build-push-action@v3
with:
platforms: linux/amd64,linux/arm64
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment