如何将多步骤docker更改为单步docker构建?

时间:2018-09-21 09:50:10

标签: docker .net-core visual-studio-2017

我应该将此多步骤docker操作(在VS2017中生成)转换为一个步骤操作:

FROM microsoft/aspnetcore:2.0-nanoserver-1709 AS base
WORKDIR /app
EXPOSE 80

FROM microsoft/aspnetcore-build:2.0-nanoserver-1709 AS build
WORKDIR /src
COPY *.sln ./
COPY Micro/Micro.csproj Micro/
RUN dotnet restore
COPY . .
WORKDIR /src/Micro
RUN dotnet build -c Release -o /app

FROM build AS publish
RUN dotnet publish -c Release -o /app

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

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

您可以使用类似docker-compose(https://docs.docker.com/compose/)之类的东西来维护多个docker。