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
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 akdevopscoaching/myspringbootapp:${IMAGE_TAG} . | |
docker push akdevopscoaching/myspringbootapp:${IMAGE_TAG} | |