Docker Image creation and Deployment Tag Update #32
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: Docker Image creation and Deployment Tag Update | |
on: workflow_dispatch | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create docker tag | |
id: vars | |
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Build and push the Home Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
context: ./k8s-crud-microservice/build/code/home | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/k8s-crud:home-${{ steps.vars.outputs.sha_short }} | |
- name: Build and push the Create Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
context: ./k8s-crud-microservice/build/code/create | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/k8s-crud:create-${{ steps.vars.outputs.sha_short }} | |
- name: Build and push the Read Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
context: ./k8s-crud-microservice/build/code/read | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/k8s-crud:read-${{ steps.vars.outputs.sha_short }} | |
- name: Build and push the Update Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
context: ./k8s-crud-microservice/build/code/update | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/k8s-crud:update-${{ steps.vars.outputs.sha_short }} | |
- name: Build and push the Delete Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
context: ./k8s-crud-microservice/build/code/delete | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/k8s-crud:delete-${{ steps.vars.outputs.sha_short }} | |
- name: Git Update new Image tag | |
run: | | |
python3 k8s-crud-microservice/deploy/helm-charts/image-tag.py -i ${{ steps.vars.outputs.sha_short }} | |
git config --global user.name 'vishnuswmech' | |
git config --global user.email '[email protected]' | |
git commit -am "Image tag updation" | |
git push |