【发布时间】:2020-06-21 20:24:30
【问题描述】:
我正在使用由 Visual Studio 创建的 DockerFile 来创建我的图像。我想使用 Azure DevOps 构建并将我的程序集版本设置为我在管道中的版本。我觉得我必须改变这条线,但我不知道如何。
RUN dotnet build "ImportBatch.Api.csproj" -c Release -o /app/build
我的 Docker 文件
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["ImportBatch.Api/ImportBatch.Api.csproj", "ImportBatch.Api/"]
COPY ["ImportBach.Dto/ImportBatch.Dto.csproj", "ImportBach.Dto/"]
COPY ["Common/Common.csproj", "Common/"]
COPY ["Common.Dto/Common.Dto.csproj", "Common.Dto/"]
COPY ["Common.Azure.Storage/Common.Azure.Storage.csproj", "Common.Azure.Storage/"]
RUN dotnet restore "ImportBatch.Api/ImportBatch.Api.csproj"
COPY . .
WORKDIR "/src/ImportBatch.Api"
RUN dotnet build "ImportBatch.Api.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "ImportBatch.Api.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Cardinal.Software.ImportBatch.Api.dll"]
【问题讨论】:
-
无法获得您的最新信息,Krzysztof Madej 的解决方法对您有帮助吗?或者,如果您有任何疑虑,请随时在此处分享。
-
有了这个下一个问题是如何将 1.2.3.4(版本号)从 azure devops 传递到 dockerfile
标签: asp.net-core azure-devops dockerfile