diff --git a/samples/aspnetapp/Dockerfile.alpine b/samples/aspnetapp/Dockerfile.alpine index 4a4af368d6..32d1c39b11 100644 --- a/samples/aspnetapp/Dockerfile.alpine +++ b/samples/aspnetapp/Dockerfile.alpine @@ -4,14 +4,13 @@ FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-alpine AS build ARG TARGETARCH WORKDIR /source -# optimize -RUN --mount=type=bind,source=aspnetapp/aspnetapp.csproj,target=aspnetapp.csproj \ - --mount=type=cache,target=/root/.nuget/ \ - dotnet restore -a $TARGETARCH +# copy csproj and restore as distinct layers +COPY aspnetapp/*.csproj . +RUN dotnet restore -a $TARGETARCH # copy and publish app and libraries COPY aspnetapp/. . -RUN dotnet publish -a $TARGETARCH -o /app +RUN dotnet publish --no-restore -a $TARGETARCH -o /app # Enable globalization and time zones: