Revert Docker Image URL (#733) #9
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: 'App Deploy [Azure - DEV]' | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**/*.md' | |
- .docker* | |
- .env.example | |
- .gitignore | |
- .pa11yci | |
- .tool-versions | |
- .yardopts | |
- bin/* | |
- docker-compose.* | |
- terraform/** | |
- terraform-azure/** | |
- uml/* | |
# Permissions for OIDC authentication | |
permissions: | |
id-token: write | |
contents: read | |
env: | |
ARM_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | |
ARM_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
ARM_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | |
DOCKER_IMAGE: ghcr.io/dfe-digital/early-years-foundation-recovery | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
environment: development | |
steps: | |
# Checkout the repository to the GitHub Actions runner | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
# Login to Azure using OIDC | |
- name: Login to Azure CLI | |
uses: azure/login@v1 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
# Login to the container registry | |
- name: Login to Github Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Create and boot Docker image builder | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
version: v0.9.1 | |
# Build and push image | |
- name: Build and push Docker Image | |
uses: docker/build-push-action@v4 | |
with: | |
target: app | |
context: . | |
push: true | |
build-args: | | |
BUILDKIT_INLINE_CACHE=1 | |
SHA=${{ github.sha }} | |
cache-from: | | |
${{ env.DOCKER_IMAGE }}:${{ github.sha }} | |
tags: | | |
${{ env.DOCKER_IMAGE }}:${{ github.sha }} | |
${{ env.DOCKER_IMAGE }}:latest | |
# Deploy Web Application | |
- name: Deploy to Azure App Services | |
uses: azure/webapps-deploy@v2 | |
with: | |
app-name: ${{ vars.WEBAPP_NAME }} | |
images: ${{ env.DOCKER_IMAGE }}:${{ github.sha }} | |
# Deploy Background Worker | |
- name: Deploy to Azure Container Instances | |
uses: azure/aci-deploy@v1 | |
with: | |
resource-group: ${{ secrets.AZURE_RESOURCE_GROUP }} | |
image: ${{ env.DOCKER_IMAGE }}:${{ github.sha }} | |
name: eyrecovery-worker | |
location: 'west europe' |