docker-ce-packaging/Makefile

92 строки
2.9 KiB
Makefile
Исходник Обычный вид История

include common.mk
STATIC_VERSION=$(shell static/gen-static-ver $(realpath $(CURDIR)/src/github.com/docker/docker) $(VERSION))
# Taken from: https://www.cmcrossroads.com/article/printing-value-makefile-variable
print-% : ; @echo $($*)
.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)
.PHONY: clean-src
clean-src:
[ ! -d src ] || $(CHOWN) -R $(shell id -u):$(shell id -g) src
$(RM) -r src
.PHONY: src
src: src/github.com/docker/cli src/github.com/docker/docker src/github.com/docker/compose src/github.com/docker/scan-cli-plugin ## clone source
ifdef CLI_DIR
src/github.com/docker/cli:
mkdir -p "$(@D)"
cp -r "$(CLI_DIR)" $@
else
src/github.com/docker/cli:
git init $@
git -C $@ remote add origin "$(DOCKER_CLI_REPO)"
endif
ifdef ENGINE_DIR
src/github.com/docker/docker:
mkdir -p "$(@D)"
cp -r "$(ENGINE_DIR)" $@
else
src/github.com/docker/docker:
git init $@
git -C $@ remote add origin "$(DOCKER_ENGINE_REPO)"
endif
src/github.com/docker/compose:
git init $@
git -C $@ remote add origin "$(DOCKER_COMPOSE_REPO)"
src/github.com/docker/scan-cli-plugin:
git init $@
git -C $@ remote add origin "$(DOCKER_SCAN_REPO)"
.PHONY: checkout-cli
checkout-cli: src/github.com/docker/cli
./scripts/checkout.sh src/github.com/docker/cli "$(DOCKER_CLI_REF)"
.PHONY: checkout-docker
checkout-docker: src/github.com/docker/docker
./scripts/checkout.sh src/github.com/docker/docker "$(DOCKER_ENGINE_REF)"
.PHONY: checkout-compose
checkout-compose: src/github.com/docker/compose
./scripts/checkout.sh src/github.com/docker/compose "$(DOCKER_COMPOSE_REF)"
.PHONY: checkout-scan-cli-plugin
checkout-scan-cli-plugin: src/github.com/docker/scan-cli-plugin
./scripts/checkout.sh src/github.com/docker/scan-cli-plugin "$(DOCKER_SCAN_REF)"
.PHONY: checkout
checkout: checkout-cli checkout-docker checkout-compose checkout-scan-cli-plugin ## checkout source at the given reference(s)
.PHONY: clean
clean: clean-src ## remove build artifacts
$(MAKE) -C rpm clean
$(MAKE) -C deb clean
$(MAKE) -C static clean
.PHONY: deb rpm
deb rpm: checkout ## build rpm/deb packages
$(MAKE) -C $@ VERSION=$(VERSION) GO_VERSION=$(GO_VERSION) $@
.PHONY: centos-% fedora-% rhel-%
centos-% fedora-% rhel-%: checkout ## build rpm packages for the specified distro
$(MAKE) -C rpm VERSION=$(VERSION) GO_VERSION=$(GO_VERSION) $@
.PHONY: debian-% raspbian-% ubuntu-%
debian-% raspbian-% ubuntu-%: checkout ## build deb packages for the specified distro
$(MAKE) -C deb VERSION=$(VERSION) GO_VERSION=$(GO_VERSION) $@
.PHONY: static
static: DOCKER_BUILD_PKGS:=static-linux cross-mac cross-win cross-arm
static: checkout ## build static-compiled packages
for p in $(DOCKER_BUILD_PKGS); do \
static: add option to specify containerd and runc version This allows passing `CONTAINERD_VERSION` and `RUNC_VERSION` make vars to override the default version in the upstream repository's Dockerfile. With this, it's easier to make the static packages match the latest released `containerd.io` deb/rpm (which are used by the .deb and .rpm docker-ce packages), without having to modify the upstream moby repository. Currently, this uses the DOCKER_BUILD_OPTS make variable, which is available in the moby Makefile, but work is in progress to add `CONTAINERD_VERSION` and `RUNC_VERSION` make variables in the upstream repository. Once those changes are merged, we can update the makefile in this repository accordingly. With this patch: If `RUNC_VERSION` and `CONTAINERD_VERSION` are not passed, the defaults are used: $ make \ DOCKER_BUILD_PKGS=static-linux \ REF=v20.10.8 \ VERSION=v20.10.8 \ static $ docker run --rm -v $(pwd)/static/build/linux/docker/:/docker alpine sh -c '/docker/containerd --version && /docker/runc --version' containerd github.com/containerd/containerd v1.4.9 e25210fe30a0a703442421b0f60afac609f950a3 runc version 1.0.1 commit: v1.0.1-0-g4144b638 spec: 1.0.2-dev go: go1.16.8 libseccomp: 2.4.4 Passing the `RUNC_VERSION` and `CONTAINERD_VERSION` vars overrides the version of containerd and runc: $ make \ DOCKER_BUILD_PKGS=static-linux \ REF=v20.10.8 \ VERSION=v20.10.8 \ RUNC_VERSION=v1.0.2 \ CONTAINERD_VERSION=v1.4.10 \ static $ docker run --rm -v $(pwd)/static/build/linux/docker/:/docker alpine sh -c '/docker/containerd --version && /docker/runc --version' containerd github.com/containerd/containerd v1.4.10 8848fdb7c4ae3815afcc990a8a99d663dda1b590 runc version 1.0.2 commit: v1.0.2-0-g52b36a2d spec: 1.0.2-dev go: go1.16.8 libseccomp: 2.4.4 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-10-04 10:44:09 +03:00
$(MAKE) -C $@ VERSION=$(VERSION) GO_VERSION=$(GO_VERSION) TARGETPLATFORM=$(TARGETPLATFORM) CONTAINERD_VERSION=$(CONTAINERD_VERSION) RUNC_VERSION=$(RUNC_VERSION) $${p}; \
done