| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | name: docker |
| 9 | |
| 10 | on: |
| 11 | push: |
| 12 | branches: [main] |
| 13 | tags: ["v*"] |
| 14 | workflow_dispatch: |
| 15 | |
| 16 | |
| 17 | concurrency: |
| 18 | group: docker-${{ github.ref }} |
| 19 | cancel-in-progress: true |
| 20 | |
| 21 | jobs: |
| 22 | build: |
| 23 | runs-on: ubuntu-latest |
| 24 | permissions: |
| 25 | contents: read |
| 26 | packages: write |
| 27 | |
| 28 | steps: |
| 29 | - name: Checkout |
| 30 | uses: actions/checkout@v4 |
| 31 | |
| 32 | - name: Set up Docker Buildx |
| 33 | uses: docker/setup-buildx-action@v3 |
| 34 | |
| 35 | |
| 36 | - name: Log in to GHCR |
| 37 | uses: docker/login-action@v3 |
| 38 | with: |
| 39 | registry: ghcr.io |
| 40 | username: ${{ github.actor }} |
| 41 | password: ${{ secrets.GITHUB_TOKEN }} |
| 42 | |
| 43 | - name: Derive image tags and labels |
| 44 | id: meta |
| 45 | uses: docker/metadata-action@v5 |
| 46 | with: |
| 47 | images: ghcr.io/${{ github.repository }} |
| 48 | tags: | |
| 49 | type=ref,event=branch |
| 50 | type=semver,pattern={{version}} |
| 51 | type=semver,pattern={{major}}.{{minor}} |
| 52 | type=semver,pattern={{major}} |
| 53 | type=raw,value=latest,enable={{is_default_branch}} |
| 54 | type=sha,format=short |
| 55 | |
| 56 | - name: Build and push |
| 57 | uses: docker/build-push-action@v6 |
| 58 | with: |
| 59 | context: . |
| 60 | push: true |
| 61 | tags: ${{ steps.meta.outputs.tags }} |
| 62 | labels: ${{ steps.meta.outputs.labels }} |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | platforms: linux/amd64 |
| 68 | |
| 69 | |
| 70 | provenance: false |
| 71 | cache-from: type=gha |
| 72 | cache-to: type=gha,mode=max |