Skip to content

Instantly share code, notes, and snippets.

@ptupitsyn
ptupitsyn / Dockerfile
Created June 15, 2023 13:05
Working .NET multi-arch Docker build (ARM + Intel)
# See https://devblogs.microsoft.com/dotnet/improving-multiplatform-container-support/
# 8.0-preview-alpine works too
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-preview AS build
ARG TARGETARCH
WORKDIR /source
# copy csproj and restore as distinct layers
COPY *.csproj .
RUN dotnet restore -a $TARGETARCH