txlit

使用Docker调试Asp.Net Core

[[使用 Docker 进行部署|https://windsting.github.io/little-aspnetcore-book/book/chapters/deploy-the-application/deploy-with-docker.html]]

;目前还是使用将发布出来的文件打包进docker镜像的形式

```bash
$ docker build -t pims .
$ docker run --name pims --rm -d -p 8080:80 pims
```

;运行Vue.js编译出来的前端代码
```bash
$ docker run -p 8081:80 --name pimsweb -v D:/Corechina/Penbox/task/项目投资管理/vue发布/projectinvestment:/usr/share/nginx/html --rm -d nginx:stable-alpine
```

Dockerfile如下

```dockerfile
FROM microsoft/dotnet AS build
COPY PIMS/*.csproj ./app/PIMS/
WORKDIR /app/PIMS
RUN dotnet restore

COPY PIMS/. ./
RUN dotnet publish -o out /p:PublishWithAspNetCoreTargetManifest="false"

FROM microsoft/dotnet AS runtime
ENV ASPNETCORE_URLS http://+:80
WORKDIR /app
COPY --from=build /app/PIMS/out ./
COPY PIMS/bin/Release/netcoreapp2.1/PIMS.xml ./
ENTRYPOINT ["dotnet", "PIMS.dll"]
```

;运行Swagger UI
```bash
$ docker run -p 8082:80 --name swagger -v D:\penbox\swagger\swagger-ui-master\dist:/usr/share/nginx/html --rm -d nginx:stable-alpine
```

posted on 2018-09-29 08:51 释怀我的诺亚尔 阅读(...) 评论(...) 编辑 收藏

相关文章:

  • 2022-12-23
  • 2021-07-06
  • 2021-12-09
  • 2018-11-20
  • 2021-07-18
  • 2021-07-11
  • 2019-03-21
猜你喜欢
  • 2021-05-24
  • 2021-08-02
  • 2018-06-20
  • 2017-12-16
相关资源
相似解决方案