Update README.md #91
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: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
services: | |
docker: | |
image: docker:19.03.12 | |
options: --privileged | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Docker Compose | |
run: | | |
docker-compose --version | |
- name: Run tests | |
run: | | |
echo "Running test" | |
docker-compose -f docker-compose-staging.yml run nextjsazure npm run check | |
docker system prune -a -f --filter "until=24h" | |
# build-and-push: | |
# needs: test | |
# runs-on: ubuntu-latest | |
# environment: production | |
# steps: | |
# - uses: actions/checkout@v2 | |
# - name: Log in to Azure Container Registry | |
# uses: docker/login-action@v1 | |
# with: | |
# registry: realtestchallenge.azurecr.io | |
# username: ${{ secrets.USER2 }} | |
# password: ${{ secrets.TOKEN2 }} | |
# - name: Build and push Docker image | |
# run: | | |
# echo "Building Docker image..." | |
# docker build -f Dockerfile-staging -t realtestchallenge.azurecr.io/web:latest . | |
# echo "Pushing image to Azure Container Registry..." | |
# docker push realtestchallenge.azurecr.io/web:latest | |
# deploy: | |
# needs: build-and-push | |
# runs-on: ubuntu-latest | |
# environment: production | |
# steps: | |
# - name: Login to Azure | |
# uses: azure/login@v1 | |
# with: | |
# creds: '{"clientId":"${{ secrets.AZURE_APP_ID }}", "clientSecret":"${{ secrets.AZURE_SP_SECRET }}", "subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION_ID }}", "tenantId":"${{ secrets.AZURE_TENANT_ID }}"}' | |
# - name: Restart Container Instance | |
# run: az container restart --name nextjsazure --resource-group cloud-shell-storage-southeastasia | |
# - name: Trigger redeployment | |
# run: az webapp restart --name nextjsazure --resource-group cloud-shell-storage-southeastasia | |
# - name: Trigger VM to repull image and restart app | |
# run: | | |
# az vm run-command invoke --resource-group cloud-shell-storage-southeastasia --name nextjsazure --command-id RunShellScript --scripts "docker ps -a | grep nextjsazure && docker stop nextjsazure && docker rm nextjsazure || echo 'No existing container to stop and remove' && docker pull realtestchallenge.azurecr.io/web:latest && docker run --name nextjsazure -d -p 80:8000 realtestchallenge.azurecr.io/web:latest" |