Remove .terraform directory and large files #33
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 and Deploy to AKS | |
on: | |
push: | |
branches: | |
- ci-test | |
jobs: | |
build-and-push: | |
name: Build and Push Docker Image to Docker Hub | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build Docker image | |
run: docker build -t "${{ secrets.DOCKER_IMAGE_NAME }}:latest" . | |
- name: Push Docker image | |
run: docker push "${{ secrets.DOCKER_IMAGE_NAME }}:latest" | |
docker_scout_scan: | |
needs: build-and-push | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Pull Docker image | |
run: docker pull "${{ secrets.DOCKER_IMAGE_NAME }}:latest" | |
- name: Install Docker Scout | |
run: | | |
curl -fsSL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh | |
- name: Run Docker Scout vulnerability scan | |
run: docker scout cves "${{ secrets.DOCKER_IMAGE_NAME }}:latest" --output json > scout-report.json | |
- name: Upload Docker Scout report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: scout-report | |
path: scout-report.json | |
deploy_app_with_ansible: | |
needs: docker_scout_scan | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install Azure CLI | |
uses: azure/setup-azurecli@v1 | |
- name: Install Ansible | |
run: | | |
sudo apt update | |
sudo apt install -y ansible | |
ansible-galaxy collection install community.kubernetes | |
- name: Set up kubeconfig | |
run: | | |
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }} | |
az aks get-credentials --resource-group projet-log8100 --name example-aks1 | |
- name: Run Ansible playbook | |
run: | | |
cd ansible | |
ansible-playbook -i localhost, deploy-app.yml | |