Update build.yml #7
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: Build, Analyze, and Scans | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-analyze-scan: | |
name: Build, Analyze, and Scan | |
runs-on: [self-hosted] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Build and analyze with SonarQube | |
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 # Add your specific npm install command | |
- name: Docker Login | |
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker Scout Scan | |
run: | | |
docker-scout quickview fs://. | |
docker-scout cves fs://. | |
- name: Docker build and push | |
run: | | |
# Run commands to build and push Docker images | |
docker build -t myntra . | |
docker tag myntra sevenajay/myntra:latest | |
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }} | |
docker push sevenajay/myntra:latest | |
env: | |
DOCKER_CLI_ACI: 1 | |
- name: Docker Scout Image Scan | |
run: | | |
docker-scout quickview sevenajay/myntra:latest | |
docker-scout cves sevenajay/myntra:latest | |