car*_*ics 16 c# docker dockerfile asp.net-core
我在asp.net-core 2.0 preview1中开发了应用程序.我使用Visual Studio 2017在Windows上开发.
现在我想使用Docker将它部署到Linux服务器.
我创建了Docker文件:
FROM microsoft/aspnetcore:2.0
ARG source
WORKDIR /app
EXPOSE 44305
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "Aplication.dll"]
Run Code Online (Sandbox Code Playgroud)
之后运行命令:
dotnet build -o obj/Docker/publish -c Release
dotnet publish -o obj/Docker/publish -c Release
docker build -t testapi-api .
docker run -p 44305:80 --name api testapi-api
Run Code Online (Sandbox Code Playgroud)
最后一个命令run我得到下一个错误:
An assembly specified in the application dependencies manifest (Aplication.deps.json) was not found:
package: 'Microsoft.AspNetCore.Antiforgery', version: '2.0.0-preview1-final'
path: 'lib/netcoreapp2.0/Microsoft.AspNetCore.Antiforgery.dll'
This assembly was expected to be in the local runtime store as the application was published using the following target manifest files:
manifest.win7-x64.xml;manifest.win7-x86.xml;manifest.osx-x64.xml;manifest.linux-x64.xml
Run Code Online (Sandbox Code Playgroud)
我是asp.net-core的新手,尤其是Docker.所以对此有任何帮助都很棒.
Lan*_*ayx 13
您需要在dotnet publish命令中指定-r linux-x64参数,如下所示:
dotnet publish -o obj/Docker/publish -c Release -r linux-x64
Run Code Online (Sandbox Code Playgroud)
这将进行独立部署.
| 归档时间: |
|
| 查看次数: |
7259 次 |
| 最近记录: |