Skip to content

Commit

Permalink
Pass tagged Docker image to Bicep deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelgira23 committed Sep 19, 2023
1 parent d883346 commit 2b38a8b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ env:
jobs:
build:
runs-on: ubuntu-latest
outputs:
backend-docker: ${{ steps.output-image.outputs.image }}
permissions:
contents: read
packages: write
Expand Down Expand Up @@ -96,12 +98,11 @@ jobs:

# Output Docker image URL
- name: Output Docker image URL
id: output-image
run: |
echo "${{ steps.build-and-push.outputs.metadata }}"
echo "${{ fromJSON(steps.build-and-push.outputs.metadata)['image.name'] }}"
echo "${{ steps.meta.outputs.tags }}"
echo "Just get first tag"
echo "${{ steps.meta.outputs.tags }}" | head -n 1
# Get the first image tag (which should correspond with the exact full Git commit hash)
USE_IMAGE=$(echo "${{ steps.meta.outputs.tags }}" | head -n 1 )
echo "image=$USE_IMAGE" >> "$GITHUB_OUTPUT"
deploy:
needs: build
Expand Down Expand Up @@ -130,6 +131,6 @@ jobs:
scope: resourcegroup
resourceGroupName: ${{ env.ResourceGroupName }}
template: ./azuredeploy.bicep
parameters: resourceNamePrefix=mymicdstwest3 emailUri=${{ secrets.EMAIL_URI }} jwtSecret=${{ secrets.JWT_SECRET }} openWeatherApiKey=${{ secrets.OPEN_WEATHER_API_KEY }} portalDayRotation=${{ secrets.PORTAL_DAY_ROTATION }} googleServiceAccount=${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
parameters: resourceNamePrefix=mymicdstwest3 backendImage=${{ needs.build.outputs.backend-docker }} emailUri=${{ secrets.EMAIL_URI }} jwtSecret=${{ secrets.JWT_SECRET }} openWeatherApiKey=${{ secrets.OPEN_WEATHER_API_KEY }} portalDayRotation=${{ secrets.PORTAL_DAY_ROTATION }} googleServiceAccount=${{ secrets.GOOGLE_SERVICE_ACCOUNT }}
# Because warnings will make this part fail otherwise
failOnStdErr: false
5 changes: 4 additions & 1 deletion azuredeploy.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ param location string = 'westus3'
param resourceNamePrefix string
var envResourceNamePrefix = toLower(resourceNamePrefix)

@description('Docker image for API backend')
param backendImage string = 'ghcr.io/mymicds/mymicds-v2:latest'

@secure()
param emailUri string

Expand Down Expand Up @@ -300,7 +303,7 @@ resource azfunctionapp 'Microsoft.Web/sites@2022-09-01' = {
properties: {
managedEnvironmentId: environment.id
siteConfig: {
linuxFxVersion: 'Docker|mcr.microsoft.com/azure-functions/dotnet7-quickstart-demo:1.0'
linuxFxVersion: 'Docker|${backendImage}'
appSettings: [
{
name: 'AzureWebJobsStorage'
Expand Down

0 comments on commit 2b38a8b

Please sign in to comment.