Context
我正在尝试部署一个ASPNET核心示例应用程序上Heroku https://heroku.com/与 docker 但不工作。
repo: https://github.com/mykeels/sample-web-api https://github.com/mykeels/sample-web-api
guide: https://blog.devcenter.co/deploy-asp-net-core-2-0-apps-on-heroku-eea8efd918b6 https://blog.devcenter.co/deploy-asp-net-core-2-0-apps-on-heroku-eea8efd918b6
环境
框架.NET 核心 2.1.201
SO:W10 内部版本 17134.1
Docker:适用于 Windows 的 Docker 版本 18.03.1-ce-win65(17513)
我所做的步骤
dotnet publish
docker build
Heroku Login
Tag and Push
Docker File
App on Heroku
Not running
I Also tried this:
问题: 怎么了?
这是使用 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
创建一个名为“的简单批处理文件(假定 Windows 操作系统)”发布.bat"
NOTE - When 点网清洁运行后,它不会清除发布文件夹。我建议您在发布之前删除该目录的内容。您可以根据需要将其添加到批处理文件中。
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%
从解决方案的根目录,现在只需运行publish.bat
c:\dev\my-amazing-app\publish.bat
信息:
- Heroku - Docker 说明:https://devcenter.heroku.com/articles/container-registry-and-runtime https://devcenter.heroku.com/articles/container-registry-and-runtime
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)