From 4dd74c7db4646dc9c48ef615c7dfd2ddd9c6f199 Mon Sep 17 00:00:00 2001 From: Tarashish Mishra Date: Sat, 10 Aug 2024 10:56:00 +0200 Subject: [PATCH] docker image building and publishing workflow --- .github/workflows/docker-build.yaml | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/docker-build.yaml diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml new file mode 100644 index 0000000..6f93643 --- /dev/null +++ b/.github/workflows/docker-build.yaml @@ -0,0 +1,44 @@ +name: Build and push container image + +on: + workflow_dispatch: + push: + branches: + - main + +env: + REGISTRY: ghcr.io + IMAGE_NAME: sunu/nfs-ganesha + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to the container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + with: + install: true + + - name: Build and push container image + uses: docker/build-push-action@v6 + with: + context: ./nfs-ganesha + file: ./nfs-ganesha/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:{{ github.sha }}, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + labels: org.opencontainers.image.source="${{ github.repository }}" \ No newline at end of file