mirror of https://github.com/docker/cli.git
Update the README
Remove referenced to developing on the host, we shouldn't support it. Move script/validate to scripts/validate to be consistent. Set the default target to be binary instead of clean. Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
a408fb0a61
commit
60b2dd3e23
6
Makefile
6
Makefile
|
@ -2,6 +2,8 @@
|
||||||
# github.com/docker/cli
|
# github.com/docker/cli
|
||||||
#
|
#
|
||||||
|
|
||||||
|
all: binary
|
||||||
|
|
||||||
# remove build artifacts
|
# remove build artifacts
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
|
@ -35,10 +37,10 @@ dynbinary:
|
||||||
.PHONY: vendor
|
.PHONY: vendor
|
||||||
vendor: vendor.conf
|
vendor: vendor.conf
|
||||||
@vndr 2> /dev/null
|
@vndr 2> /dev/null
|
||||||
@script/validate/check-git-diff vendor
|
@scripts/validate/check-git-diff vendor
|
||||||
|
|
||||||
cli/compose/schema/bindata.go: cli/compose/schema/data/*.json
|
cli/compose/schema/bindata.go: cli/compose/schema/data/*.json
|
||||||
go generate github.com/docker/cli/cli/compose/schema
|
go generate github.com/docker/cli/cli/compose/schema
|
||||||
|
|
||||||
compose-jsonschema: cli/compose/schema/bindata.go
|
compose-jsonschema: cli/compose/schema/bindata.go
|
||||||
@script/validate/check-git-diff cli/compose/schema/bindata.go
|
@scripts/validate/check-git-diff cli/compose/schema/bindata.go
|
||||||
|
|
52
README.md
52
README.md
|
@ -6,60 +6,42 @@ docker/cli
|
||||||
This repository is the home of the cli used in the Docker CE and
|
This repository is the home of the cli used in the Docker CE and
|
||||||
Docker EE products.
|
Docker EE products.
|
||||||
|
|
||||||
It's composed of 3 main folders
|
|
||||||
|
|
||||||
* `/cli` - all the commands code.
|
|
||||||
* `/cmd/docker` - the entrypoint of the cli, aka the main.
|
|
||||||
|
|
||||||
Development
|
Development
|
||||||
===========
|
===========
|
||||||
|
|
||||||
### Build locally
|
`docker/cli` is developed using Docker.
|
||||||
|
|
||||||
|
Build a linux binary:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ make build
|
$ make -f docker.Makefile binary
|
||||||
```
|
```
|
||||||
|
|
||||||
```
|
Build binaries for all supported platforms:
|
||||||
$ make clean
|
|
||||||
```
|
|
||||||
|
|
||||||
You will need [gox](https://github.com/mitchellh/gox) for this one:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ make cross
|
|
||||||
```
|
|
||||||
|
|
||||||
If you don't have [gox](https://github.com/mitchellh/gox), you can use the "in-container" version of `make cross`, listed below.
|
|
||||||
|
|
||||||
### Build inside container
|
|
||||||
|
|
||||||
```
|
|
||||||
$ make -f docker.Makefile build
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
|
||||||
$ make -f docker.Makefile clean
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
```
|
||||||
$ make -f docker.Makefile cross
|
$ make -f docker.Makefile cross
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Run all linting:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ make -f docker.Makefile lint
|
||||||
|
```
|
||||||
|
`
|
||||||
|
|
||||||
### In-container development environment
|
### In-container development environment
|
||||||
|
|
||||||
```
|
Start an interactive development environment:
|
||||||
$ make -f docker.Makefile dev
|
|
||||||
```
|
|
||||||
|
|
||||||
Then you can use the [build locally](#build-locally) commands:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
$ make build
|
$ make -f docker.Makefile shell
|
||||||
```
|
```
|
||||||
|
|
||||||
|
In the development environment you can run many tasks, including build binaries:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ make clean
|
$ make binary
|
||||||
```
|
```
|
||||||
|
|
||||||
Legal
|
Legal
|
||||||
|
|
|
@ -12,12 +12,12 @@ MOUNTS = -v `pwd`:/go/src/github.com/docker/cli
|
||||||
# build docker image (dockerfiles/Dockerfile.build)
|
# build docker image (dockerfiles/Dockerfile.build)
|
||||||
.PHONY: build_docker_image
|
.PHONY: build_docker_image
|
||||||
build_docker_image:
|
build_docker_image:
|
||||||
@docker build -q -t $(DEV_DOCKER_IMAGE_NAME) -f ./dockerfiles/Dockerfile.dev .
|
@docker build -t $(DEV_DOCKER_IMAGE_NAME) -f ./dockerfiles/Dockerfile.dev .
|
||||||
|
|
||||||
# build docker image having the linting tools (dockerfiles/Dockerfile.lint)
|
# build docker image having the linting tools (dockerfiles/Dockerfile.lint)
|
||||||
.PHONY: build_linter_image
|
.PHONY: build_linter_image
|
||||||
build_linter_image:
|
build_linter_image:
|
||||||
@docker build -q -t $(LINTER_IMAGE_NAME) -f ./dockerfiles/Dockerfile.lint .
|
@docker build -t $(LINTER_IMAGE_NAME) -f ./dockerfiles/Dockerfile.lint .
|
||||||
|
|
||||||
.PHONY: build_cross_image
|
.PHONY: build_cross_image
|
||||||
build_cross_image:
|
build_cross_image:
|
||||||
|
@ -43,7 +43,7 @@ test: build_docker_image
|
||||||
|
|
||||||
# build the CLI for multiple architectures using a container
|
# build the CLI for multiple architectures using a container
|
||||||
.PHONY: cross
|
.PHONY: cross
|
||||||
cross: build_docker_image
|
cross: build_cross_image
|
||||||
@docker run --rm $(MOUNTS) $(CROSS_IMAGE_NAME) make cross
|
@docker run --rm $(MOUNTS) $(CROSS_IMAGE_NAME) make cross
|
||||||
|
|
||||||
# start container in interactive mode for in-container development
|
# start container in interactive mode for in-container development
|
||||||
|
|
|
@ -7,6 +7,7 @@ set -eu -o pipefail
|
||||||
|
|
||||||
source ./scripts/build/.variables
|
source ./scripts/build/.variables
|
||||||
|
|
||||||
|
echo "Building statically linked $TARGET"
|
||||||
export CGO_ENABLED=0
|
export CGO_ENABLED=0
|
||||||
go build -o "${TARGET}" --ldflags "${LDFLAGS}" "${SOURCE}"
|
go build -o "${TARGET}" --ldflags "${LDFLAGS}" "${SOURCE}"
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ set -eu -o pipefail
|
||||||
|
|
||||||
export BUILDDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
export BUILDDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
echo "Building all binaries"
|
||||||
SHELL=/bin/bash parallel ::: \
|
SHELL=/bin/bash parallel ::: \
|
||||||
"$BUILDDIR/linux-cross" \
|
"$BUILDDIR/linux-cross" \
|
||||||
"$BUILDDIR/windows" \
|
"$BUILDDIR/windows" \
|
||||||
|
|
|
@ -7,6 +7,7 @@ set -eu -o pipefail
|
||||||
|
|
||||||
source ./scripts/build/.variables
|
source ./scripts/build/.variables
|
||||||
|
|
||||||
|
echo "Building dynamically linked $TARGET"
|
||||||
export CGO_ENABLED=1
|
export CGO_ENABLED=1
|
||||||
go build -o "${TARGET}" -tags pkcs11 --ldflags "${LDFLAGS}" "${SOURCE}"
|
go build -o "${TARGET}" -tags pkcs11 --ldflags "${LDFLAGS}" "${SOURCE}"
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ CROSS_OSARCH="linux/amd64 linux/arm"
|
||||||
# Not yet supported by gox
|
# Not yet supported by gox
|
||||||
# linux/s390x
|
# linux/s390x
|
||||||
|
|
||||||
|
echo "Building all linux binaries"
|
||||||
gox -output build/docker-{{.OS}}-{{.Arch}} \
|
gox -output build/docker-{{.OS}}-{{.Arch}} \
|
||||||
-osarch "${CROSS_OSARCH}" \
|
-osarch "${CROSS_OSARCH}" \
|
||||||
--ldflags "${LDFLAGS}" \
|
--ldflags "${LDFLAGS}" \
|
||||||
|
|
|
@ -15,6 +15,7 @@ export LDFLAGS='-linkmode external -s'
|
||||||
export LDFLAGS_STATIC_DOCKER='-extld='${CC}
|
export LDFLAGS_STATIC_DOCKER='-extld='${CC}
|
||||||
|
|
||||||
# Override TARGET
|
# Override TARGET
|
||||||
export TARGET="build/docker-$GOOS-$GOARCH"
|
TARGET="build/docker-$GOOS-$GOARCH"
|
||||||
|
|
||||||
|
echo "Building $TARGET"
|
||||||
go build -o "${TARGET}" -tags pkcs11 --ldflags "${LDFLAGS}" "${SOURCE}"
|
go build -o "${TARGET}" -tags pkcs11 --ldflags "${LDFLAGS}" "${SOURCE}"
|
||||||
|
|
|
@ -13,7 +13,8 @@ export GOOS=windows
|
||||||
export GOARCH=amd64
|
export GOARCH=amd64
|
||||||
|
|
||||||
# Override TARGET
|
# Override TARGET
|
||||||
export TARGET="build/docker-$GOOS-$GOARCH"
|
TARGET="build/docker-$GOOS-$GOARCH"
|
||||||
|
|
||||||
|
echo "Building $TARGET"
|
||||||
# TODO: -tags pkcs11
|
# TODO: -tags pkcs11
|
||||||
go build -o "${TARGET}" --ldflags "${LDFLAGS}" "${SOURCE}"
|
go build -o "${TARGET}" --ldflags "${LDFLAGS}" "${SOURCE}"
|
||||||
|
|
Loading…
Reference in New Issue