Cross-compiling zk
with Docker
Largely inspired by dh1tw and remoteAudio-xcompile.
You can compile the zk
source code directly from the source code directory. As example, for compiling the binary for linux/arm64 you have to execute the following command:
docker run --rm -v "$PWD":/usr/src/zk -w /usr/src/zk ghcr.io/zk-org/zk-xcompile:linux-arm64 /bin/bash -c 'make'
This call is already set in zk
Makefile
, e.g. make dist-linux-amd64
.
More detail is documented here on Golang's docker hub.
The images are hosted with ghcr within zk-org.
Clone this repo, make necessary changes, submit a PR. After PR is confirmed, proceed with building and pushing.
docker buildx build -t ghcr.io/zk-org/zk-xcompile:linux-amd64 ./linux-amd64
docker push ghcr.io/zk-org/zk-xcompile:linux-amd64
or via the build
script
./build # builds all images
./build ./linux-amd64 ./linux-arm64 # build desired images only
Logout of docker if you're currently logged in: docker logout
or via Docker Desktop.
Then login to ghcr.io
with your personal access token. Only members of zk-org
can push. Docs are here.
For example:
echo $ZK-TOKEN | docker login ghcr.io -u USERNAME --password-stdin
Then you can push to our container registry.
docker push ghcr.io/zk-org/zk-xcompile:linux-amd64
or via the push script
./push # pushes all images to zk-org ghcr
./push ./linux-amd64 ./alpine-amd64 # push desired images only