Edited entrypoint to printenv save as file #55
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 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 -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: Trigger redeployment | |
run: az webapp restart --name nextjsazure --resource-group cloud-shell-storage-southeastasia |