- 去官网下载Windows平台下的SDK并安装,与开发环境对应的版本【我的程序为.NET6.0】:https://dotnet.microsoft.com/zh-cn/download/dotnet/thank-you/sdk-6.0.417-windows-x64-installer
- 在开发好的程序中,右键添加Dockerfile支持,添加后修改配置,
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS build WORKDIR /app WORKDIR /src COPY . . RUN dotnet restore RUN dotnet publish -c Release -o publish FROM mcr.microsoft.com/dotnet/aspnet:6.0 WORKDIR /app COPY --from=build /src/publish ./ ENTRYPOINT ["dotnet", "Howdy.Net6API.AuthenticationCenter.dll"]
- 进入项目目录,打开cmd命令,执行如下
dotnet publish -o auth
- 我的程序是登录授权服务,使用postman测试部署结果
标签:WebApi,WORKDIR,Windows,publish,6.0,dotnet,sdk From: https://www.cnblogs.com/personblog/p/17920365.html