-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (52 loc) · 2.16 KB
/
docker-image-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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