-
Notifications
You must be signed in to change notification settings - Fork 97
45 lines (42 loc) · 1.46 KB
/
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
name: Build
on:
push:
branches:
- master
jobs:
build:
name: Build
runs-on: [self-hosted]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
- name: NPM Install
run: npm install
- name: Docker build and push
run: |
# Run commands to build and push Docker images
docker build -t swiggy-clone .
docker tag swiggy-clone aakibkhan1212/swiggy-clone:latest
docker login -u ${{ secrets.Dockerhub_username }} -p ${{ secrets.Dockerhub_token }}
docker push aakibkhan1212/swiggy-clone:latest
env:
DOCKER_CLI_ACI: 1
deploy:
needs: build
runs-on: [self-hosted]
steps:
- name: docker pull image
run: docker pull aakibkhan1212/swiggy-clone:latest
- name: Image scan
run: trivy image aakibkhan1212/swiggy-clone:latest > trivyimagedeploy.txt
- name: Deploy to container
run: docker run -d --name swiggy-clone1 -p 3000:3000 aakibkhan1212/swiggy-clone:latest
- name: Update kubeconfig
run: aws eks --region ap-south-1 update-kubeconfig --name EKS_CLOUD
- name: Deploy to kubernetes
run: kubectl apply -f deployment-service.yml