Docker Community Forums

Share and learn in the Docker community.

Section of windows Dockerfile taking a long time

I have a docker file that essentially looks like this.

FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-nanoserver-1809 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/core/sdk:2.2-nanoserver-1809 AS build

USER Administrator

ADD https://nodejs.org/dist/v10.7.0/node-v10.7.0-win-x64.zip C:\build\node-v10.7.0-win-x64.zip
RUN mkdir “C:\Program Files\node” &&
tar.exe -xf C:\build\node-v10.7.0-win-x64.zip -C “C:\Program Files\node” --strip-components=1
RUN setx /M PATH “C:\Program Files\node;%PATH%”

RUN RMDIR /s /q c:\build

WORKDIR /src
COPY . .

COPY .nuget/nuget.config .
RUN dotnet restore “something.csproj” --configfile nuget.config

WORKDIR “/src/folder with something.csproj”
RUN dotnet build “something.csproj” -c Release -o /app

FROM build AS publish
RUN dotnet publish “something.csproj” -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .

copy buildnumber.html /app/wwwroot
ENTRYPOINT [“dotnet”, “something.dll”]

the command COPY --from=publish /app .

takes a long time 10 min plus.

the publish folder is only 88 File(s) 6,770,947 bytes

Any ideas why it takes so long?

This copy command is taking up to 25 minutes. It seems to be excessively long. Is this normal when copying from one docker image layer to another… since this is from publish to final.

thanks in advance.