我正在尝试将我的 Azure Functions 应用程序发布到 Kubernetes,但运行此命令时出现以下错误
func kubernetes deploy --name my-function-api --namespace default --registry mycontainerregistry/docker-azure-function --csharp
找不到项目根目录。期望在项目根目录中找到 host.json、local.settings.json 之一。`
这是我的码头文件
FROM mcr.microsoft.com/dotnet/sdk:3.1 AS installer-env
COPY . .
RUN cd /MyFunctionApp.Api && \
mkdir -p /home/site/wwwroot && \
dotnet publish *.csproj --output /home/site/wwwroot
COPY /MyFunctionApp.Api/host.json /home/site/wwwroot
COPY /MyFunctionApp.Api/local.settings.json /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:3.0
ENV AzureWebJobsScriptRoot=/home/site/wwwroot \
AzureFunctionsJobHost__Logging__Console__IsEnabled=true
COPY --from=installer-env ["/home/site/wwwroot", "/home/site/wwwroot"]
如您所见,我尝试添加以下行
COPY /MyFunctionApp.Api/host.json /home/site/wwwroot
COPY /MyFunctionApp.Api/local.settings.json /home/site/wwwroot
但这似乎也无济于事,所以不确定我需要做什么才能使其正常工作?任何帮助,将不胜感激。