Skip to content

Commit

Permalink
Created CICD yaml file for creating docker image and pushing into Doc…
Browse files Browse the repository at this point in the history
…kerhub
  • Loading branch information
akannan1087 committed Apr 6, 2024
1 parent 3cce8a6 commit 2e89f6c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/main.yml
@@ -0,0 +1,27 @@
name: cicd-workflow to create docker image and upload into Dockerhub
on:
push:
branches: [ "master" ]
jobs:
job1:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '17'
- name: Build with Maven
run: mvn clean install
- 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
env:
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/myspringbootapp:${IMAGE_TAG} .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/myspringbootapp:${IMAGE_TAG}

0 comments on commit 2e89f6c

Please sign in to comment.