Leverage Golang's cross-compilation to run compilation natively, but target different architectures. This alleviates the need to run the compiler under emulation of the targets. Effectively, any target runs as fast as the native arch.
Takes under a minute to run on my Core i7-11700KF.
TARGETVARIANT will be v5/v6/v7 for the above arm targets, but was empty for the rest. I'm unsure about other architectures with variants, but this could be adapted further to only set GOARM for arm targets.
If this doesn't work out of the box (buildx seems to cache some arguments), then adding ARG BUILDPLATFORM at the top of Dockerfile and --build-arg BUILDPLATFORM=<arch> to the command should do the trick, which for me resulted in:
In the interests of getting more target platforms upstream (https://github.com/blake/external-mdns/issues/15).
Leverage Golang's cross-compilation to run compilation natively, but target different architectures. This alleviates the need to run the compiler under emulation of the targets. Effectively, any target runs as fast as the native arch.
Takes under a minute to run on my Core i7-11700KF.
TARGETVARIANT
will bev5/v6/v7
for the above arm targets, but was empty for the rest. I'm unsure about other architectures with variants, but this could be adapted further to only setGOARM
for arm targets.If this doesn't work out of the box (buildx seems to cache some arguments), then adding
ARG BUILDPLATFORM
at the top of Dockerfile and--build-arg BUILDPLATFORM=<arch>
to the command should do the trick, which for me resulted in: