Yes, I got this to both build with Docker Desktop on a M1 laptop and using crosscompiling on my Linux desktop.
Desktop: Running and Building ARM Docker Containers on x86 | Stereolabs
My dockerfile (grabbed from above):
FROM arm64v8/golang:1.16.5-buster as builder
RUN apt-get update && apt-get install -qy build-essential software-properties-common gcc make sudo
ENV CGO_ENABLED=1 GOOS=linux GOARCH=arm64
RUN go get -u -v google.golang.org/grpc && \
git clone --depth 1 --branch v21.03.1 https://www.github.com/dgraph-io/dgraph/ && \
cd dgraph && \
make dgraph
RUN mkdir -p /dist/bin && \
mkdir -p /dist/tmp && \
mv dgraph/dgraph/dgraph /dist/bin/dgraph
FROM arm64v8/debian:buster-slim as dgraph
RUN apt-get update && apt-get install libjemalloc-dev -qy
COPY --from=builder /dist /
ENV PATH=$PATH:/bin/
RUN chmod +x /bin/dgraph
WORKDIR /bin
EXPOSE 5080 6080 7080 8080 8000 9080
COPY --from=builder /go/dgraph/contrib/standalone/run.sh /run.sh
RUN chmod +x /run.sh
CMD ["/run.sh"]
Builds crazy quick on the m1, takes about 2 minutes to build via docker.