Building local arm64 docker images

If you are interested to build local copies of Dgraph for testing on arm64, you can do this with the following steps. I ran these steps below on macOS 12.3 Monterey (Macbook M1).

NOTE: This is not an officially supported release, but just for local testing.

# use go1.16.2 for Dgraph v21.03.2
# use go1.17.3 for Dgraph v21.12.0 
GO_VERSION="go1.17.3"
go install golang.org/dl/[email protected]
$GO_VERSION download

# put go1.17.3 binary in front of PATH
export GOROOT=$($GO_VERSION env GOROOT)
export PATH=$GOROOT/bin:$PATH

go version
# go version go1.17.3 darwin/arm64

# download dgraph 
mkdir -p ~/repos && cd ~/repos
git clone [email protected]:dgraph-io/dgraph.git && cd dgraph
# checkout desired version
git checkout v21.12.0

# build dgraph and docker image
GOOS=linux CGO_ENABLED=0 make
make image

docker inspect dgraph/dgraph:master | jq .[].Architecture
# "arm64"
docker run -t dgraph/dgraph:master file /usr/local/bin/dgraph
# /usr/local/bin/dgraph: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), statically linked, Go BuildID=rCDe3trlJ_e3UkbAJg7C/RfeRGbNAAHuve7RoTFqp/cpB-5WdCQYL_7H9OwQoA/1rz3MqU1jAgPssfPwnCy, not stripped