更新时间:2023-11-13 18:50:34
构建阶段中的路径很奇怪。您的项目文件将被复制到子文件夹 / src / ProcessFiles
,但是源文件将被复制到 / src
。在复制之前设置 WORKDIR
应该可以使它们放到正确的位置。
The pathing in your build phase is wonky. Your project file is being copied to the subfolder /src/ProcessFiles
, but the source files are being copied to /src
. Setting the WORKDIR
before copying should allow them to land in the right place.
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY ProcessFiles.csproj ProcessFiles/
RUN dotnet restore ProcessFiles/ProcessFiles.csproj
WORKDIR /src/ProcessFiles
COPY . .
RUN dotnet build ProcessFiles.csproj -c Release -o /app