From d778bbab845c5679b80a0491f82fdba3998ced66 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Sat, 20 Aug 2022 13:58:04 +0200 Subject: [PATCH] docs: contributing docs update for cross comp Signed-off-by: CrazyMax (cherry picked from commit 83280d44d0e62a1144ea9a97762f2555ce9f5e30) --- docs/contributing/README.md | 1 + docs/contributing/ctn-build.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 docs/contributing/ctn-build.md diff --git a/docs/contributing/README.md b/docs/contributing/README.md index d419e52c14..fb2e798061 100644 --- a/docs/contributing/README.md +++ b/docs/contributing/README.md @@ -6,5 +6,6 @@ * (Optional) [Configure project for IDE](set-up-ide.md) * [Configure Git for contributing](set-up-git.md) * [Work with a development container](set-up-dev-env.md) + * [Containerized build and cross compilation](ctn-build.md) * [Run tests and test documentation](test.md) * [Debugging the daemon](debug.md) diff --git a/docs/contributing/ctn-build.md b/docs/contributing/ctn-build.md new file mode 100644 index 0000000000..de924e6d36 --- /dev/null +++ b/docs/contributing/ctn-build.md @@ -0,0 +1,28 @@ +The `Dockerfile` supports building and cross compiling docker daemon and extra +tools using [Docker Buildx](https://github.com/docker/buildx) and [BuildKit](https://github.com/moby/buildkit). +A [bake definition](https://docs.docker.com/build/bake/file-definition/) named +`docker-bake.hcl` is in place to ease the build process: + +```shell +# build binaries for the current host platform +# output to ./bundles/binary-daemon by default +docker buildx bake +# or +docker buildx bake binary + +# build binaries for the current host platform +# output to ./bin +DESTDIR=./bin docker buildx bake + +# build dynamically linked binaries +# output to ./bundles/dynbinary-daemon by default +DOCKER_STATIC=0 docker buildx bake +# or +docker buildx bake dynbinary + +# build binaries for all supported platforms +docker buildx bake binary-cross + +# build binaries for a specific platform +docker buildx bake --set *.platform=linux/arm64 +```