1. 程式人生 > >使用Docker除錯Asp.Net Core

使用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如下

```dockerfileFROM microsoft/dotnet AS buildCOPY PIMS/*.csproj ./app/PIMS/WORKDIR /app/PIMSRUN dotnet restore

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

FROM microsoft/dotnet AS runtimeENV ASPNETCORE_URLS http://+:80WORKDIR /appCOPY --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```