From 904405ab827312151d6536857b16e603646d0b99 Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Mon, 22 Apr 2024 18:19:08 +0530 Subject: [PATCH] :whale: Add workflow to build & push docker image --- .github/workflows/docker.yml | 42 ++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..36168cf --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,42 @@ +name: Build and push Docker images to Docker Hub + +on: + workflow_dispatch: + push: + branches: + - main + +jobs: + build_docker_image: + # This workflow is only of value to Owner and would always be skipped in forks + if: github.repository_owner == 'agriyakhetarpal' + name: Build image + runs-on: buildjet-2vcpu-ubuntu-2204-arm + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push Docker image to Docker Hub + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile + tags: agriyakhetarpal/hugo:latest # To be updated with exact Docker Hub username and image name + push: true + platforms: linux/amd64, linux/arm64 + + - name: List built image(s) + run: docker images \ No newline at end of file