# Learn about building .NET container images: # https://github.com/dotnet/dotnet-docker/blob/main/samples/README.md FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:10.0 AS build ARG TARGETARCH WORKDIR /source # Copy project file and restore as distinct layers COPY --link *.csproj . RUN dotnet restore -a $TARGETARCH # Copy source code and publish app COPY --link . . RUN dotnet publish -a $TARGETARCH --no-restore -o /out # Output stage # Learn more about exporting binaries with Docker: https://docs.docker.com/build/building/export/ FROM scratch COPY --link --from=build /out .