代码之家  ›  专栏  ›  技术社区  ›  OrganicMustard

如何dockerize PowerBI embedded点.net解决方案(Owin)

  •  0
  • OrganicMustard  · 技术社区  · 6 年前

    该项目使用Owin。

    这里是Dockerfile。

    FROM mcr.microsoft.com/dotnet/core/sdk:2.2.300-alpine3.9 as server
    
    ENV ASPNETCORE_Environment=Production
    
    WORKDIR /server
    COPY . ./
    
    RUN dotnet publish -c Release -o publish
    
    ENTRYPOINT ["dotnet","publish/PowerBIEmbedded_AppOwnsData.dll"]
    

    我一直在添加一个程序.cs文件以及以下内容:

    // Copyright (c) Microsoft Corporation. All rights reserved.
    // Licensed under the MIT License.
    
    using Microsoft.AspNetCore;
    using Microsoft.AspNetCore.Hosting;
    using System;
    
    namespace PowerBIEmbedded_AppOwnsData
    {
        public class Program
        {
            public static void Main(string[] args)
            {
                CreateWebHostBuilder(args)
                    .UseKestrel()
                    .UseUrls("http://0.0.0.0:" + Environment.GetEnvironmentVariable("PORT"))
                    .Build()
                    .Run();
            }
    
            public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
                WebHost.CreateDefaultBuilder(args)
                    .UseStartup<Startup>();
        }
    }
    

    我的Docker命令如下。我曾在其他C项目中使用过它,效果很好:

    heroku container:login
    docker login --username=_ --password=$(heroku auth:token) registry.heroku.com
    docker build -t registry.heroku.com/apptestpbi/web .
    docker push registry.heroku.com/apptestpbi/web
    heroku container:release web --app apptestpbi
    heroku logs -tail -a apptestpbi
    

    没什么可做的。指定的项目都不包含要 MSB4019:导入的项目 未找到。确认声明中的路径是 dotnet publish-c Release-o publish'返回了非零代码:1

    我读过这篇文章,但是我没有看到我的代码有任何变化 Microsoft.WebApplication.targets was not found, on the build server. What's your solution? 也许我必须在Docker映像上安装Visual Studio?

    0 回复  |  直到 6 年前