GitHub Copilot Customization Explained for Beginners: Instructions, Prompt Files, Skills, Agents, and Hooks Introduction If you've recently started using GitHub Copilot, you've probably come across terms like Instructions , Prompt Files , Skills , Agents , and Hooks . At first glance, they all seem to do the same thing—they tell Copilot what to do. So why does GitHub have five different customization features? The answer is simple: each feature solves a different problem. Think of GitHub Copilot as a new developer joining your team. On their first day, you don't just hand them code. You explain your coding standards, give them reusable templates, teach them specialized knowledge, assign them a role, and automate repetitive tasks. That's exactly how GitHub Copilot customization works. In this article, you'll learn what each feature does, when to use it, and how they all work together. By the end, you'll know which feature to start with and which ones can wait un...
Azure Function in a Docker Container - Part 1
- Get link
- X
- Other Apps
From Azure Function v2, .NET developers can now write functions using .NET Core.
This means you can develop and run your Azure functions in more places
(cross-platform). This opens up opportunities for running your Azure function in
Docker container and taking it one step ahead by running Azure Functions on
Kubernetes with
KEDA (Kubernetes-based Event
Driven Autoscaling). In this blog post, we will see how to run Azure Function in
Docker Container.
In the above command flag --docker tells Azure Function Core Tool to generate the Dockerfile
Now few questions arise like why do we need to run in a container, do we lose the benefit of Serverless because you will be paying only for the time your function is running based on your plan in Azure Function, etc. All these questions are valid but as soon as we enter the world of containerization and Kubernetes we want our application to be flexible enough to be hosted in an on-premises/cloud/hybrid environment. With containerization now you can use Azure Functions as your event-driven host regardless of the environment. By having Azure Function in a docker container it enables options for hosting in different environments.
Pre-requisites
- Azure Functions Core Tools installed. The link provides options for installing in both Windows and Linux OS.
- Docker Desktop
- .NET Core installed
Build the Azure Functions container image and test locally
1. In this demo we will
Create Azure Functions
with HttpTriggered template and to support cross-platform we will
be creating Azure Function v2 and v3 versions. You can similarly create new
Azure Functions using Azure CLI commands e.g. func new
2. Create a Docker file for the respective version of Azure Function using
following command.
- Navigate to Azure Functions Project folder
- Using the CLI tool/cmd prompt/PowerShell terminal use the following command
func init --docker-only --worker-runtime dotnet --chsarp
- By default, the Docker file is created for Azure Function v2 even if you are using for Azure function v3 version. In that case please update the Docker file with the appropriate image version as shown in the below code snippet.
Azure Function v2 version of Docker file:
FROM microsoft/dotnet:2.2-sdk AS installer-env COPY . /src/dotnet-function-app RUN cd /src/dotnet-function-app && \ mkdir -p /home/site/wwwroot && \ dotnet publish *.csproj --output /home/site/wwwroot # To enable ssh & remote debugging on app service change the base image to the one below # FROM mcr.microsoft.com/azure-functions/dotnet:2.0-appservice FROM mcr.microsoft.com/azure-functions/dotnet:2.0 ENV AzureWebJobsScriptRoot=/home/site/wwwroot \ AzureFunctionsJobHost__Logging__Console__IsEnabled=true COPY --from=installer-env ["/home/site/wwwroot", "/home/site/wwwroot"]
Azure Function v3 version of Docker file:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS installer-env COPY . /src/dotnet-function-app RUN cd /src/dotnet-function-app && \ mkdir -p /home/site/wwwroot && \ dotnet publish *.csproj --output /home/site/wwwroot # To enable ssh & remote debugging on app service change the base image to the one below # FROM mcr.microsoft.com/azure-functions/dotnet:3.0-appservice FROM mcr.microsoft.com/azure-functions/dotnet:3.0 ENV AzureWebJobsScriptRoot=/home/site/wwwroot \ AzureFunctionsJobHost__Logging__Console__IsEnabled=true COPY --from=installer-env ["/home/site/wwwroot", "/home/site/wwwroot"]
- Build Azure Function docker images using the below commands by navigating to the docker file folder.
docker build -t azurefuncv3 .
Code on GitHub: https://tinyurl.com/rajurh-azurefuncwithcontainers
Now you might be interested in how to run it on Azure, check out this post Azure Function in a Docker Container - Part 2
Popular posts from this blog
Tidy up - Unused Project and Nuget package reference using Visual Studio 2019
If you are a Developer/Architect using Visual Studio as IDE for your development activities, this blog post will be of your interest. During the Ignite 2021 conference, Microsoft released Visual Studio 2019 v16.9 and v16.10 Preview 1. As part of version 16.10 Preview 1, one of the cool features they introduced is to "Remove Unused References..." for any Projects and Nuget packages that are not in use. At the time of writing this blog post, we have Visual Studio Version 16.10.0 (official release) which includes this new feature. As part of development, we generally get carried away and introduce new Nuget package references to your project and add new references to your Projects. By the end of development, you will not be 100% sure which are not being referenced and unused which means you will leave those unused project references in your application. Now you might be wondering what's the big deal in it since it doesn't harm. The advantage of removing unused project r...
Azure Front Door vs Azure Traffic Manager?
In my previous blog post, we looked in detail Azure Front Door (AFD) . In this blog post, let's compare Azure Front Door (AFD) with another popular Azure service named Azure Traffic Manager (ATM). Prior to AFD most of the applications made use of ATM in their architecture now with AFD being available it's good to understand in which scenarios these individual services are ideal. Azure Front Door (AFD) Azure Front Door Service (AFD) a scalable and secure entry point for the fast delivery of your global applications. Azure Front Door allows you to transform your global (multi-region) applications into robust, high-performance applications, APIs, and content. Azure Traffic Manager (ATM) Azure Traffic Manager is a DNS-based traffic load balancer for geographically distributed Datacenters. Traffic Manager uses DNS to direct traffic to endpoint based on the traffic routing method and health of the endpoints. Similarities between AFD and ATM Both Azure Services support Multi-...
Authenticate Azure Functions - API Keys
In this blog post, we will see one of the ways to secure your Azure Functions using API keys. Security plays a key role as part of SDLC (Software Development Life Cycle) doesn't matter whether it's exposed to the client/public or even if it's internal. There are multiple ways to secure your Azure Functions like API Keys, Certificate, API Mgmt, App Service Authentication, etc. If you are new to the Cloud and Azure Functions but want to make a start with minimal effort and less setup of Infrastructure, then API Keys is the ideal choice. Azure Functions allows you to secure HTTP-triggered functions by API access key in the request. As part of creating new Azure Functions, we can select the Authorization Level enum value. If we set the Authorisation level to Anonymous, no security applied which means no authentication applied for the endpoint. Authorization Level - Function By setting the Authorisation level to Function each Azure Functions require a specific API key to Au...
Comments
DevOps Free Tutorial for Beginners
Kubernetes Free Tutorial for Beginners
Ansible Free Tutorial for Beginners
Docker Free Tutorial for Beginners
Openstack Free Tutorial for Beginners
Learn Linux, Cloud and DevOps
Post a Comment