diff --git a/static/Makefile b/static/Makefile index 85a90bc22e..e1e3efa016 100644 --- a/static/Makefile +++ b/static/Makefile @@ -4,6 +4,8 @@ CLI_DIR=$(realpath $(CURDIR)/../src/github.com/docker/cli) ENGINE_DIR=$(realpath $(CURDIR)/../src/github.com/docker/docker) BUILDX_DIR=$(realpath $(CURDIR)/../src/github.com/docker/buildx) +ENGINE_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/docker) && git rev-parse --short HEAD) + GEN_STATIC_VER=$(shell ./gen-static-ver $(CLI_DIR) $(VERSION)) HASH_CMD=docker run -v $(CURDIR):/sum -w /sum debian:jessie bash hash_files DIR_TO_HASH:=build/linux @@ -22,6 +24,8 @@ ifneq ($(strip $(RUNC_VERSION)),) DOCKER_BUILD_OPTS +=--build-arg=RUNC_VERSION=$(RUNC_VERSION) endif +ENGINE_BUILD_OPTS=--build-arg VERSION=$(GEN_STATIC_VER) --build-arg DOCKER_GITCOMMIT=$(ENGINE_GITCOMMIT) --build-arg DEFAULT_PRODUCT_LICENSE --build-arg PACKAGER_NAME --build-arg PLATFORM $(DOCKER_BUILD_OPTS) + .PHONY: help help: ## show make targets @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) @@ -40,15 +44,15 @@ static-linux: static-cli static-engine static-buildx-plugin ## create tgz mkdir -p build/linux/docker cp $(CLI_DIR)/build/docker build/linux/docker/ for f in dockerd containerd ctr containerd-shim containerd-shim-runc-v2 docker-init docker-proxy runc; do \ - cp -L $(ENGINE_DIR)/bundles/binary-daemon/$$f build/linux/docker/$$f; \ + cp -L $(ENGINE_DIR)/bundles/binary/$$f build/linux/docker/$$f; \ done tar -C build/linux -c -z -f build/linux/docker-$(GEN_STATIC_VER).tgz docker # extra binaries for running rootless mkdir -p build/linux/docker-rootless-extras for f in rootlesskit rootlesskit-docker-proxy dockerd-rootless.sh dockerd-rootless-setuptool.sh vpnkit; do \ - if [ -f $(ENGINE_DIR)/bundles/binary-daemon/$$f ]; then \ - cp -L $(ENGINE_DIR)/bundles/binary-daemon/$$f build/linux/docker-rootless-extras/$$f; \ + if [ -f $(ENGINE_DIR)/bundles/binary/$$f ]; then \ + cp -L $(ENGINE_DIR)/bundles/binary/$$f build/linux/docker-rootless-extras/$$f; \ fi \ done tar -C build/linux -c -z -f build/linux/docker-rootless-extras-$(GEN_STATIC_VER).tgz docker-rootless-extras @@ -80,8 +84,8 @@ cross-win: cross-win-engine cd $(CLI_DIR) && VERSION=$(GEN_STATIC_VER) docker buildx bake --set binary.platform=windows/amd64 binary mkdir -p build/win/amd64/docker cp $(CLI_DIR)/build/docker-windows-amd64.exe build/win/amd64/docker/docker.exe - cp $(ENGINE_DIR)/bundles/cross/windows/amd64-daemon/dockerd.exe build/win/amd64/docker/dockerd.exe - cp $(ENGINE_DIR)/bundles/cross/windows/amd64-daemon/docker-proxy.exe build/win/amd64/docker/docker-proxy.exe + cp $(ENGINE_DIR)/bundles/cross/win/dockerd.exe build/win/amd64/docker/dockerd.exe + cp $(ENGINE_DIR)/bundles/cross/win/docker-proxy.exe build/win/amd64/docker/docker-proxy.exe docker run --rm -v $(CURDIR)/build/win/amd64:/v -w /v alpine sh -c 'apk update&&apk add zip&&zip -r docker-$(GEN_STATIC_VER).zip docker' $(CHOWN) -R $(shell id -u):$(shell id -g) build @@ -97,7 +101,7 @@ static-cli: .PHONY: static-engine static-engine: - $(MAKE) -C $(ENGINE_DIR) VERSION=$(GEN_STATIC_VER) DOCKER_BUILD_OPTS="$(DOCKER_BUILD_OPTS)" binary + cd $(ENGINE_DIR) && docker buildx build --target all $(ENGINE_BUILD_OPTS) --output "./bundles/binary" . .PHONY: static-buildx-plugin static-buildx-plugin: @@ -109,4 +113,4 @@ cross-all-cli: .PHONY: cross-win-engine cross-win-engine: - $(MAKE) -C $(ENGINE_DIR) VERSION=$(GEN_STATIC_VER) DOCKER_CROSSPLATFORMS=windows/amd64 DOCKER_BUILD_OPTS="$(DOCKER_BUILD_OPTS)" cross + cd $(ENGINE_DIR) && docker buildx build --target binary $(ENGINE_BUILD_OPTS) --platform windows/amd64 --output "./bundles/cross/win" .