|
| 1 | +# Building your own Docker static package |
| 2 | + |
| 3 | +Static packages can be built from this directory with the following syntax |
| 4 | + |
| 5 | +```console |
| 6 | +make TARGETPLATFORM=${TARGETOS}/${TARGETARCH}/${TARGETVARIANT} build |
| 7 | +``` |
| 8 | + |
| 9 | +Format of `TARGETOS`, `TARGETARCH`, `TARGETVARIANT` is the same as the [platform ARGs in the global scope](https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope) |
| 10 | +for a Dockerfile like `linux/arm/v7`. |
| 11 | + |
| 12 | +Artifacts will be located in `build` under the following directory structure: |
| 13 | +`build/$os/$arch/$variant/` or `build/$os/$arch/` if there is no variant being |
| 14 | +used. |
| 15 | + |
| 16 | +### Building from local source |
| 17 | + |
| 18 | +Specify the location of the source repositories for the engine and cli when |
| 19 | +building packages |
| 20 | + |
| 21 | +* `ENGINE_DIR` -> Specifies the directory where the engine code is located, eg: `$GOPATH/src/github.com/docker/docker` |
| 22 | +* `CLI_DIR` -> Specifies the directory where the cli code is located, eg: `$GOPATH/src/github.com/docker/cli` |
| 23 | + |
| 24 | +```shell |
| 25 | +make ENGINE_DIR=/path/to/engine CLI_DIR=/path/to/cli TARGETPLATFORM=linux/amd64 build |
| 26 | +``` |
| 27 | + |
| 28 | +## Supported platforms |
| 29 | + |
| 30 | +Here is a list of platforms that are currently supported: |
| 31 | + |
| 32 | +```console |
| 33 | +make TARGETPLATFORM=linux/amd64 build |
| 34 | +make TARGETPLATFORM=linux/arm/v6 build |
| 35 | +make TARGETPLATFORM=linux/arm/v7 build |
| 36 | +make TARGETPLATFORM=linux/arm64 build |
| 37 | +make TARGETPLATFORM=darwin/amd64 build |
| 38 | +make TARGETPLATFORM=darwin/arm64 build |
| 39 | +make TARGETPLATFORM=windows/amd64 build |
| 40 | +``` |
| 41 | + |
| 42 | +> note: `darwin` only packages the docker cli and plugins. |
| 43 | +
|
| 44 | +But you can test building against whatever platform you want like: |
| 45 | + |
| 46 | +```console |
| 47 | +make TARGETPLATFORM=linux/riscv64 build |
| 48 | +make TARGETPLATFORM=linux/s390x build |
| 49 | +``` |
0 commit comments