简体   繁体   English

Docker 映像创建 - Net core 3.1 web API - 具有多个项目的单一解决方案

[英]Docker image creation - Net core 3.1 web API - Single solution with multiple projects

I have created web api in .net core 3.1 with docker file and include the DAL project.我已经在 .net 核心 3.1 中创建了 web api 和 Z05B6053C41A8B6053C41A2130AFDZ6FC3E 文件和项目DAL project is common for all API. DAL 项目对所有 API 都是通用的。 This is my project structure这是我的项目结构

                  --Solution
                    dockerfile
                  --DAL Project

This is my docker file format这是我的 docker 文件格式

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /src
COPY ["Notification.csproj", ""]
COPY ["../DAL/DAL.csproj", "../DAL/"]
RUN dotnet restore "./Notification.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "Notification.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Notification.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Notification.dll"] 

While build the application VS Code I got below error在构建应用程序 VS Code 时出现以下错误

COPY failed: failed to resolve scoped path..\DAL_DAL.csproj (): evalSymlinksInScope: \?\C:\ProgramData\Docker\tmp\DAL\DAL.csproj is not in \?\C:\ProgramData\Docker\tmp\docker-builder572417841. COPY failed: failed to resolve scoped path..\DAL_DAL.csproj (): evalSymlinksInScope: \?\C:\ProgramData\Docker\tmp\DAL\DAL.csproj is not in \?\C:\ProgramData\Docker\tmp \docker-builder572417841。 Possible cause is a forbidden path outside the build context可能的原因是构建上下文之外的禁止路径

Any help would be appreciated.任何帮助,将不胜感激。

this is my project structure;这是我的项目结构;

项目结构

And this is my Dockerfile in SampleApp.API;这是我在 SampleApp.API 中的 Dockerfile;

Dockerfile

Maybe it can be an example for you.也许它可以成为你的一个例子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Docker .NET Core - 解决方案中的多个项目 - Docker .NET Core - multiple projects in solution asp.net core 2.0 - 多项目解决方案 docker 文件 - asp.net core 2.0 - multiple projects solution docker file 解决方案 .NET 中 Docker 多个项目的问题 - Problems with Docker multiple projects in solution .NET Docker:运行 docker 后无法在浏览器上启动 .Net Core 3.1 Web Api - Docker: Cannot launch .Net Core 3.1 Web Api on browser after docker run .NET 内核 3.1 Web API 与 Docker 桌面。 访问容器而不在 VS.NET 中运行项目 - .NET Core 3.1 Web API with Docker Desktop. Access container without running project in VS.NET .Net 核心 docker 构建与多个项目 - .Net core docker build with multiple projects 您如何为 docker-compose 正确设置 .net core 3.1 web api url? - How do you correctly set a .net core 3.1 web api url for docker-compose? C# and Docker - Can't connect to containerized MySQL server from containerized .NET Core 3.1 Web API - C# and Docker - Can't connect to containerized MySQL server from containerized .NET Core 3.1 Web API .net 核心 3.1 api 文件上传错误 413 wen i 部署 docker 映像到 ZB76E9BB58AF9AAAD68019 - .net core 3.1 api file upload error 413 wen i deploy docker image to kubernetes docker 容器与 .net 核心 3.1 web 应用程序的问题 - issue with docker container with .net core 3.1 web app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM