Car*_*que 2 heroku docker .net-core dockerfile
我正在尝试使用docker在Heroku上部署一个aspnet 核心示例应用程序,但无法正常工作。
回购:https : //github.com/mykeels/sample-web-api
指南:https : //blog.devcenter.co/deploy-asp-net-core-2-0-apps-on-heroku-eea8efd918b6
框架.NET Core 2.1.201
SO: W10 Build 17134.1
Docker: Docker for Windows 版本 18.03.1-ce-win65(17513)
这是您可以使用 Heroku 进行这项工作的另一种方法。
在解决方案的根目录中创建 Dockerfile
#https://github.com/dotnet/dotnet-docker/tree/master/samples/aspnetapp
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /app
COPY . .
CMD ASPNETCORE_URLS=http://*:$PORT dotnet [THE NAME OF YOUR FILE].dll
Run Code Online (Sandbox Code Playgroud)
创建一个名为“ publish.bat ”的简单批处理文件(假定为 Windows 操作系统)
注意-运行dotnet clean 时,它不会清除发布文件夹。我建议您在发布前删除目录的内容。您可以根据需要将其添加到批处理文件中。
REM - This file assumes that you have access to the application and that you have docker installed
REM : Setup your applications name below
SET APP_NAME=""
REM - Delete all files and folders in publish
del /q ".\bin\Release\netcoreapp2.1\publish\*"
FOR /D %%p IN (".\bin\Release\netcoreapp2.1\publish\*.*") DO rmdir "%%p" /s /q
dotnet clean --configuration Release
dotnet publish -c Release
copy Dockerfile .\bin\Release\netcoreapp2.1\publish\
cd .\bin\Release\netcoreapp2.1\publish\
call heroku container:login
call heroku container:push web -a %APP_NAME%
call heroku container:release web -a %APP_NAME%
Run Code Online (Sandbox Code Playgroud)
从解决方案的根目录,现在只需运行 publish.bat
c:\dev\my-amazing-app\publish.bat
Run Code Online (Sandbox Code Playgroud)
信息:
| 归档时间: |
|
| 查看次数: |
4095 次 |
| 最近记录: |