Update Netflix.yml #3
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,Scan | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-analyze-scan: | |
name: Build | |
runs-on: ubuntu-latest | |
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: install trivy | |
run: | | |
#install trivy | |
sudo apt-get install wget apt-transport-https gnupg lsb-release -y | |
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null | |
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee -a /etc/apt/sources.list.d/trivy.list | |
sudo apt-get update | |
sudo apt-get install trivy -y | |
#command to scan files | |
trivy fs . | |
- name: Docker build and push | |
run: | | |
# run commands to build and push docker images | |
docker build --build-arg TMDB_V3_API_KEY=7fb617e8853393994aea60297c588763 -t netflix . | |
docker tag netflix gitya/netflix:latest | |
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p $ {{ secrers.DOCKERHUB.TOKEN }} | |
docker push gitya/netflix:latest | |
env: | |
DOCKER_CLI_ACI: 1 | |
# If you wish to fail your job when the Quality Gate is red, uncomment the | |
# following lines. This would typically be used to fail a deployment. | |
# - uses: sonarsource/sonarqube-quality-gate-action@master | |
# timeout-minutes: 5 | |
# env: | |
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |