I am new to containerization. I have a native C++ library which I need to deploy to Azure App Services. Since Azure app services doesn’t support native C++, I thought of wrapping the native C++ project with C++/CLI wrapper project, and calling that wrapper project from a main C# ASP.NET project that I can deploy to Azure. When running locally, it works fine but I am not able to publish it to Azure App Services. Therefore, can someone please help me write a Dockerfile to build a windows docker image, that I can deploy to Azure, because I can deploy docker container to Azure.
What I have so far is:
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /source
COPY . .
RUN dotnet restore “NativeCPPWrapper.sln”
RUN dotnet build “NativeCPPWrapper.sln” -c Release -o /app/build
RUN dotnet publish “NativeCPPWrapper.sln” -c Release -o /app/build
FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
COPY - -from=build /app ./
EXPOSE 80
EXPOSE 443
ENTRYPOINT [“dotnet”, “NativeCPPWrapper.dll”]
Any help would be greatly appreciated. Thanks.
The .NET SDK image doesn't have the tools needed to build a C++/CLI image. You're going to need to make your own build image installing the Visual Studio Build tools with the .NET and C++ components. There is a guide for Installing Build Tools into a container, but it may be easier to start with the Dockerfile used for the .NET SDK framework image. Note that neither example includes all the components you'll need, but you can find the full list here. Hard to say not knowing your project's details, but I suspect you'll want the components from the framework SDK Dockerflie linked above and the workload Microsoft.VisualStudio.Workload.VCTools
and component Microsoft.VisualStudio.Component.VC.CLI.Support