From ad3e8f6b3da4e8861f63f1fa7c700829efc32f24 Mon Sep 17 00:00:00 2001 From: Anirudh Oppiliappan Date: Sun, 6 Oct 2024 17:29:41 +0300 Subject: [PATCH] actions: build and push docker --- .github/workflows/docker.yaml | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/docker.yaml diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml new file mode 100644 index 0000000..708cc0f --- /dev/null +++ b/.github/workflows/docker.yaml @@ -0,0 +1,52 @@ +name: build and push docker image + +on: + push: + branches: [master] + tags: ["*"] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + attestations: write + id-token: write + + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: Copy Dockerfile to . + run: cp ./contrib/Dockerfile ./Dockerfile + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: . + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + push: true + build-args: | + BUILDKIT_INLINE_CACHE=1