Skip to content

Instantly share code, notes, and snippets.

@dabbinavo
Last active February 14, 2025 19:42
Show Gist options
  • Save dabbinavo/7f84ea429fcba5f329fbbc4962649546 to your computer and use it in GitHub Desktop.
Save dabbinavo/7f84ea429fcba5f329fbbc4962649546 to your computer and use it in GitHub Desktop.
.NET: Build NativeAOT enabled linux-arm on x64 host
docker build -t dotnet-cross-linux-arm:latest .
docker run --rm -v /path/to/project/:/myapp -w /myapp dotnet-linux-cross-arm:latest dotnet publish -r linux-arm -p:LinkerFlavor=lld -p:ObjCopy=llvm-objcopy -p:SysRoot=/crossrootfs/arm
FROM mcr.microsoft.com/dotnet-buildtools/prereqs:azurelinux-3.0-cross-arm-net9.0
RUN curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 9.0
RUN ln -s /root/.dotnet/dotnet /usr/bin/dotnet
CMD ["/bin/bash"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment