diff --git a/Makefile b/Makefile index 74e3e2d509..4b9a71eae8 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,8 @@ # github.com/docker/cli # +all: binary + # remove build artifacts .PHONY: clean clean: @@ -35,10 +37,10 @@ dynbinary: .PHONY: vendor vendor: vendor.conf @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 go generate github.com/docker/cli/cli/compose/schema 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 diff --git a/README.md b/README.md index 66db952beb..fcf49495ce 100644 --- a/README.md +++ b/README.md @@ -6,60 +6,42 @@ docker/cli This repository is the home of the cli used in the Docker CE and 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 =========== -### Build locally +`docker/cli` is developed using Docker. + +Build a linux binary: ``` -$ make build +$ make -f docker.Makefile binary ``` -``` -$ 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 -``` +Build binaries for all supported platforms: ``` $ make -f docker.Makefile cross ``` +Run all linting: + +``` +$ make -f docker.Makefile lint +``` +` + ### In-container development environment -``` -$ make -f docker.Makefile dev -``` - -Then you can use the [build locally](#build-locally) commands: +Start an interactive development environment: ``` -$ make build +$ make -f docker.Makefile shell ``` +In the development environment you can run many tasks, including build binaries: + ``` -$ make clean +$ make binary ``` Legal diff --git a/docker.Makefile b/docker.Makefile index cf5a239066..5fde78e470 100644 --- a/docker.Makefile +++ b/docker.Makefile @@ -12,12 +12,12 @@ MOUNTS = -v `pwd`:/go/src/github.com/docker/cli # build docker image (dockerfiles/Dockerfile.build) .PHONY: 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) .PHONY: 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 build_cross_image: @@ -43,7 +43,7 @@ test: build_docker_image # build the CLI for multiple architectures using a container .PHONY: cross -cross: build_docker_image +cross: build_cross_image @docker run --rm $(MOUNTS) $(CROSS_IMAGE_NAME) make cross # start container in interactive mode for in-container development diff --git a/scripts/build/binary b/scripts/build/binary index d4faac11b5..b40f9d5f9d 100755 --- a/scripts/build/binary +++ b/scripts/build/binary @@ -7,6 +7,7 @@ set -eu -o pipefail source ./scripts/build/.variables +echo "Building statically linked $TARGET" export CGO_ENABLED=0 go build -o "${TARGET}" --ldflags "${LDFLAGS}" "${SOURCE}" diff --git a/scripts/build/cross b/scripts/build/cross index 5fa23d4783..b9df606fca 100755 --- a/scripts/build/cross +++ b/scripts/build/cross @@ -4,6 +4,7 @@ set -eu -o pipefail export BUILDDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +echo "Building all binaries" SHELL=/bin/bash parallel ::: \ "$BUILDDIR/linux-cross" \ "$BUILDDIR/windows" \ diff --git a/scripts/build/dynbinary b/scripts/build/dynbinary index 153a62fbdd..d1107338ab 100755 --- a/scripts/build/dynbinary +++ b/scripts/build/dynbinary @@ -7,6 +7,7 @@ set -eu -o pipefail source ./scripts/build/.variables +echo "Building dynamically linked $TARGET" export CGO_ENABLED=1 go build -o "${TARGET}" -tags pkcs11 --ldflags "${LDFLAGS}" "${SOURCE}" diff --git a/scripts/build/linux-cross b/scripts/build/linux-cross index fa5c9cf047..4a43e4b396 100755 --- a/scripts/build/linux-cross +++ b/scripts/build/linux-cross @@ -15,6 +15,7 @@ CROSS_OSARCH="linux/amd64 linux/arm" # Not yet supported by gox # linux/s390x +echo "Building all linux binaries" gox -output build/docker-{{.OS}}-{{.Arch}} \ -osarch "${CROSS_OSARCH}" \ --ldflags "${LDFLAGS}" \ diff --git a/scripts/build/osx b/scripts/build/osx index 505bdeb26b..b993a8e0c8 100755 --- a/scripts/build/osx +++ b/scripts/build/osx @@ -15,6 +15,7 @@ export LDFLAGS='-linkmode external -s' export LDFLAGS_STATIC_DOCKER='-extld='${CC} # 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}" diff --git a/scripts/build/windows b/scripts/build/windows index 5f47be5d4f..eccf6d1e57 100755 --- a/scripts/build/windows +++ b/scripts/build/windows @@ -13,7 +13,8 @@ export GOOS=windows export GOARCH=amd64 # Override TARGET -export TARGET="build/docker-$GOOS-$GOARCH" +TARGET="build/docker-$GOOS-$GOARCH" +echo "Building $TARGET" # TODO: -tags pkcs11 go build -o "${TARGET}" --ldflags "${LDFLAGS}" "${SOURCE}" diff --git a/script/validate/check-git-diff b/scripts/validate/check-git-diff similarity index 100% rename from script/validate/check-git-diff rename to scripts/validate/check-git-diff