这是VS2017生成的Dockerfile,在本地运行良好。
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY ["MyProj/WebApi.csproj", "WebApi/"]
COPY ["MyProject.Common/MyProject.Common.csproj", "MyProj.Common/"]
RUN dotnet restore "MyProject.WebApi/MyProject.WebApi.csproj"
COPY . .
WORKDIR "/src/MyProject.WebApi"
RUN dotnet build "MyProject.WebApi.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "MyProject.WebApi.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "MyProject.WebApi.dll"]
我已经在Azure DevOps下创建了一个构建管道,以通过以下步骤运行Docker Build:
docker build -t WebApi ./MyProject.WebApi
我遇到此错误
2019-02-01T21:30:14.3797039Z COPY failed: stat /var/lib/docker/tmp/docker-builder684976980/MyProject.WebApi/MyProject.WebApi.csproj: no such file or directory
2019-02-01T21:30:14.3910070Z ##[error]Bash exited with code '1'.
2019-02-01T21:30:14.3994657Z ##[section]Finishing: Command Line Script
我不明白我在做什么错。 有什么建议吗?
答案 0 :(得分:0)
在这种情况下,错误是由于脚本在错误的目录中运行