updates based on feedback
This commit is contained in:
@@ -1,17 +1,39 @@
|
||||
# Action Requires
|
||||
# 1. Setup the AZURE_CREDENTIALS secrets in your GitHub Repository
|
||||
# 2. Setup the REGISTRY_USERNAME secrets in your GitHub Repository
|
||||
# 3. Setup the REGISTRY_PASSWORD secrets in your GitHub Repository
|
||||
# 4. Replace REGISTRY, NAMESPACE, IMAGE, TAG in the following template with proper values
|
||||
# 5. Add this yaml file to your project's .github/workflows/
|
||||
# 6. Push your local project to your GitHub Repository
|
||||
# This workflow will build a container and deploy it to an Azure Functions App on Linux when a commit is pushed to your default branch.
|
||||
#
|
||||
# This workflow assumes you have already created the target Azure Functions app.
|
||||
# For instructions see https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-function-linux-custom-image?tabs=in-process%2Cbash%2Cazure-cli&pivots=programming-language-csharp
|
||||
#
|
||||
# To configure this workflow:
|
||||
# 1. Set up the following secrets in your repository:
|
||||
# - AZURE_RBAC_CREDENTIALS
|
||||
# - REGISTRY_USERNAME
|
||||
# - REGISTRY_PASSWORD
|
||||
# 2. Change env variables for your configuration.
|
||||
#
|
||||
# For more information on:
|
||||
# - GitHub Actions for Azure: https://github.com/Azure/Actions
|
||||
# - Azure Functions Container Action: https://github.com/Azure/functions-container-action
|
||||
# - Azure Service Principal for RBAC: https://github.com/Azure/functions-action#using-azure-service-principal-for-rbac-as-deployment-credential
|
||||
#
|
||||
# For more samples to get started with GitHub Action workflows to deploy to Azure: https://github.com/Azure/actions-workflow-samples/tree/master/FunctionApp
|
||||
|
||||
name: Linux_Container_Workflow
|
||||
name: Deploy container to Azure Functions App
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- [$default-branch]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
AZURE_FUNCTIONAPP_NAME: 'your-app-name' # set this to your function app name on Azure
|
||||
LOGIN_SERVER: 'login-server' # set this to login server for your private container registry (e.g. 'contoso.azurecr.io', 'index.docker.io' )
|
||||
REGISTRY: 'your-registry' # set this to proper value for REGISTRY
|
||||
NAMESPACE: 'your-namespace' # set this to proper value for NAMESPACE
|
||||
IMAGE: 'your-image' # set this to proper value for IMAGE
|
||||
TAG: 'your-tag' # set this to proper value for TAG
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
@@ -24,12 +46,12 @@ jobs:
|
||||
- name: 'Login via Azure CLI'
|
||||
uses: azure/login@v1
|
||||
with:
|
||||
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
||||
creds: ${{ secrets.AZURE_RBAC_CREDENTIALS }}
|
||||
|
||||
- name: 'Docker Login'
|
||||
uses: azure/docker-login@v1
|
||||
with:
|
||||
login-server: contoso.azurecr.io
|
||||
login-server: ${{ env.LOGIN_SERVER }}
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
@@ -38,20 +60,21 @@ jobs:
|
||||
run: |
|
||||
# If your function app project is not located in your repository's root
|
||||
# Please change the path to your directory for docker build
|
||||
docker build . -t REGISTRY/NAMESPACE/IMAGE:TAG
|
||||
docker push REGISTRY/NAMESPACE/IMAGE:TAG
|
||||
docker build . -t ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.IMAGE }}:${{ env.TAG }}
|
||||
docker push ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.IMAGE }}:${{ env.TAG }}
|
||||
|
||||
- name: 'Run Azure Functions Container Action'
|
||||
uses: Azure/functions-container-action@v1
|
||||
id: fa
|
||||
with:
|
||||
app-name: PLEASE_REPLACE_THIS_WITH_YOUR_FUNCTION_APP_NAME
|
||||
image: REGISTRY/NAMESPACE/IMAGE:TAG
|
||||
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
|
||||
image: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.IMAGE }}:${{ env.TAG }}
|
||||
|
||||
#- name: 'use the published functionapp url in upcoming steps'
|
||||
# If you want to display or use the functionapp url, then uncomment the task below
|
||||
#- name: 'Published functionapp url'
|
||||
# run: |
|
||||
# echo "${{ steps.fa.outputs.app-url }}"
|
||||
|
||||
- name: Azure logout
|
||||
run: |
|
||||
az logout
|
||||
az logout
|
||||
|
||||
Reference in New Issue
Block a user