.github/workflows/docker.yaml (view raw)
1name: build and push docker image
2
3on:
4 push:
5 branches: [master]
6 tags: ["*"]
7
8env:
9 REGISTRY: ghcr.io
10 IMAGE_NAME: ${{ github.repository }}
11
12jobs:
13 build:
14 runs-on: ubuntu-latest
15 permissions:
16 contents: read
17 packages: write
18 attestations: write
19 id-token: write
20
21 steps:
22 - name: Check out code
23 uses: actions/checkout@v4
24
25 - name: Copy Dockerfile to .
26 run: cp ./contrib/Dockerfile ./Dockerfile
27
28 - name: Set up Docker Buildx
29 uses: docker/setup-buildx-action@v3
30
31 - name: Login to GitHub Container Registry
32 uses: docker/login-action@v3
33 with:
34 registry: ghcr.io
35 username: ${{ github.repository_owner }}
36 password: ${{ secrets.GITHUB_TOKEN }}
37
38 - name: Docker meta
39 id: meta
40 uses: docker/metadata-action@v5
41 with:
42 images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
43
44 - name: Build and push Docker image
45 uses: docker/build-push-action@v6
46 with:
47 context: .
48 tags: ${{ steps.meta.outputs.tags }}
49 labels: ${{ steps.meta.outputs.labels }}
50 push: true
51 build-args: |
52 BUILDKIT_INLINE_CACHE=1