From 261f3c371b40795101c81d605c266873cb62042e Mon Sep 17 00:00:00 2001 From: saimanaswini-k Date: Wed, 14 Aug 2024 12:32:05 +0530 Subject: [PATCH] Feat : Github actions for docker build --- .github/workflows/build.yml | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..bc6d855 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,50 @@ +name: Build and Deploy + +on: + push: + tags: + - '*' + branches: + - master + - release-* + +jobs: + Docker-build: + runs-on: ubuntu-20.04 + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + with: + build-scan-publish: true + build-scan-terms-of-use-url: "https://gradle.com/terms-of-service" + build-scan-terms-of-use-agree: "yes" + + - name: Run build with JDK 11 + run: | + gradle -v + ./gradlew build + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and Push Docker Image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + tags: | + ${{ vars.DOCKERHUB_USERNAME }}/adminutil:${{ github.ref_name }} +