Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created CICD yaml file for creating docker image and pushing into Doc…
…kerhub
- Loading branch information
1 parent
3cce8a6
commit 2e89f6c
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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} |