mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Makefile: always use buildx
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -19,8 +19,6 @@ env:
|
|||||||
GOTESTLIST_VERSION: v0.2.0
|
GOTESTLIST_VERSION: v0.2.0
|
||||||
TESTSTAT_VERSION: v0.1.3
|
TESTSTAT_VERSION: v0.1.3
|
||||||
ITG_CLI_MATRIX_SIZE: 6
|
ITG_CLI_MATRIX_SIZE: 6
|
||||||
BUILDX: docker buildx
|
|
||||||
USE_BUILDX: 1
|
|
||||||
DOCKER_EXPERIMENTAL: 1
|
DOCKER_EXPERIMENTAL: 1
|
||||||
DOCKER_GRAPHDRIVER: overlay2
|
DOCKER_GRAPHDRIVER: overlay2
|
||||||
|
|
||||||
|
|||||||
12
Jenkinsfile
vendored
12
Jenkinsfile
vendored
@@ -262,12 +262,6 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
agent { label 'ppc64le-ubuntu-1604' }
|
agent { label 'ppc64le-ubuntu-1604' }
|
||||||
// ppc64le machines run on Docker 18.06, and buildkit has some
|
|
||||||
// bugs on that version. Build and use buildx instead.
|
|
||||||
environment {
|
|
||||||
USE_BUILDX = '1'
|
|
||||||
DOCKER_BUILDKIT = '0'
|
|
||||||
}
|
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage("Print info") {
|
stage("Print info") {
|
||||||
@@ -382,12 +376,6 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
agent { label 'ppc64le-ubuntu-1604' }
|
agent { label 'ppc64le-ubuntu-1604' }
|
||||||
// ppc64le machines run on Docker 18.06, and buildkit has some
|
|
||||||
// bugs on that version. Build and use buildx instead.
|
|
||||||
environment {
|
|
||||||
USE_BUILDX = '1'
|
|
||||||
DOCKER_BUILDKIT = '0'
|
|
||||||
}
|
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage("Print info") {
|
stage("Print info") {
|
||||||
|
|||||||
45
Makefile
45
Makefile
@@ -1,21 +1,7 @@
|
|||||||
.PHONY: all binary dynbinary build cross help install manpages run shell test test-docker-py test-integration test-unit validate validate-% win
|
.PHONY: all binary dynbinary build cross help install manpages run shell test test-docker-py test-integration test-unit validate validate-% win
|
||||||
|
|
||||||
BUILDX_VERSION ?= v0.9.1
|
|
||||||
|
|
||||||
ifdef USE_BUILDX
|
|
||||||
BUILDX ?= $(shell command -v buildx)
|
|
||||||
BUILDX ?= $(shell command -v docker-buildx)
|
|
||||||
DOCKER_BUILDX_CLI_PLUGIN_PATH ?= ~/.docker/cli-plugins/docker-buildx
|
|
||||||
BUILDX ?= $(shell if [ -x "$(DOCKER_BUILDX_CLI_PLUGIN_PATH)" ]; then echo $(DOCKER_BUILDX_CLI_PLUGIN_PATH); fi)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef USE_BUILDX
|
|
||||||
DOCKER_BUILDKIT := 1
|
|
||||||
export DOCKER_BUILDKIT
|
|
||||||
endif
|
|
||||||
|
|
||||||
BUILDX ?= bundles/buildx
|
|
||||||
DOCKER ?= docker
|
DOCKER ?= docker
|
||||||
|
BUILDX ?= $(DOCKER) buildx
|
||||||
|
|
||||||
# set the graph driver as the current graphdriver if not set
|
# set the graph driver as the current graphdriver if not set
|
||||||
DOCKER_GRAPHDRIVER := $(if $(DOCKER_GRAPHDRIVER),$(DOCKER_GRAPHDRIVER),$(shell docker info 2>&1 | grep "Storage Driver" | sed 's/.*: //'))
|
DOCKER_GRAPHDRIVER := $(if $(DOCKER_GRAPHDRIVER),$(DOCKER_GRAPHDRIVER),$(shell docker info 2>&1 | grep "Storage Driver" | sed 's/.*: //'))
|
||||||
@@ -156,12 +142,7 @@ DOCKER_BUILD_ARGS += --build-arg=SYSTEMD=true
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
BUILD_OPTS := ${BUILD_APT_MIRROR} ${DOCKER_BUILD_ARGS} ${DOCKER_BUILD_OPTS} -f "$(DOCKERFILE)"
|
BUILD_OPTS := ${BUILD_APT_MIRROR} ${DOCKER_BUILD_ARGS} ${DOCKER_BUILD_OPTS} -f "$(DOCKERFILE)"
|
||||||
ifdef USE_BUILDX
|
|
||||||
BUILD_OPTS += $(BUILDX_BUILD_EXTRA_OPTS)
|
|
||||||
BUILD_CMD := $(BUILDX) build
|
BUILD_CMD := $(BUILDX) build
|
||||||
else
|
|
||||||
BUILD_CMD := $(DOCKER) build
|
|
||||||
endif
|
|
||||||
|
|
||||||
# This is used for the legacy "build" target and anything still depending on it
|
# This is used for the legacy "build" target and anything still depending on it
|
||||||
BUILD_CROSS =
|
BUILD_CROSS =
|
||||||
@@ -179,14 +160,14 @@ default: binary
|
|||||||
all: build ## validate all checks, build linux binaries, run all tests,\ncross build non-linux binaries, and generate archives
|
all: build ## validate all checks, build linux binaries, run all tests,\ncross build non-linux binaries, and generate archives
|
||||||
$(DOCKER_RUN_DOCKER) bash -c 'hack/validate/default && hack/make.sh'
|
$(DOCKER_RUN_DOCKER) bash -c 'hack/validate/default && hack/make.sh'
|
||||||
|
|
||||||
binary: buildx ## build statically linked linux binaries
|
binary: bundles ## build statically linked linux binaries
|
||||||
$(BUILD_CMD) $(BUILD_OPTS) --output=bundles/ --target=$@ $(VERSION_AUTOGEN_ARGS) .
|
$(BUILD_CMD) $(BUILD_OPTS) --output=bundles/ --target=$@ $(VERSION_AUTOGEN_ARGS) .
|
||||||
|
|
||||||
dynbinary: buildx ## build dynamically linked linux binaries
|
dynbinary: bundles ## build dynamically linked linux binaries
|
||||||
$(BUILD_CMD) $(BUILD_OPTS) --output=bundles/ --target=$@ $(VERSION_AUTOGEN_ARGS) .
|
$(BUILD_CMD) $(BUILD_OPTS) --output=bundles/ --target=$@ $(VERSION_AUTOGEN_ARGS) .
|
||||||
|
|
||||||
cross: BUILD_OPTS += --build-arg CROSS=true --build-arg DOCKER_CROSSPLATFORMS
|
cross: BUILD_OPTS += --build-arg CROSS=true --build-arg DOCKER_CROSSPLATFORMS
|
||||||
cross: buildx ## cross build the binaries for darwin, freebsd and\nwindows
|
cross: bundles ## cross build the binaries for darwin, freebsd and\nwindows
|
||||||
$(BUILD_CMD) $(BUILD_OPTS) --output=bundles/ --target=$@ $(VERSION_AUTOGEN_ARGS) .
|
$(BUILD_CMD) $(BUILD_OPTS) --output=bundles/ --target=$@ $(VERSION_AUTOGEN_ARGS) .
|
||||||
|
|
||||||
bundles:
|
bundles:
|
||||||
@@ -214,11 +195,8 @@ build: shell_target := --target=dev
|
|||||||
else
|
else
|
||||||
build: shell_target := --target=final
|
build: shell_target := --target=final
|
||||||
endif
|
endif
|
||||||
ifdef USE_BUILDX
|
build: bundles
|
||||||
build: buildx_load := --load
|
$(BUILD_CMD) $(BUILD_OPTS) $(shell_target) --load $(BUILD_CROSS) -t "$(DOCKER_IMAGE)" .
|
||||||
endif
|
|
||||||
build: buildx
|
|
||||||
$(BUILD_CMD) $(BUILD_OPTS) $(shell_target) $(buildx_load) $(BUILD_CROSS) -t "$(DOCKER_IMAGE)" .
|
|
||||||
|
|
||||||
shell: build ## start a shell inside the build env
|
shell: build ## start a shell inside the build env
|
||||||
$(DOCKER_RUN_DOCKER) bash
|
$(DOCKER_RUN_DOCKER) bash
|
||||||
@@ -269,14 +247,3 @@ swagger-docs: ## preview the API documentation
|
|||||||
-e 'REDOC_OPTIONS=hide-hostname="true" lazy-rendering' \
|
-e 'REDOC_OPTIONS=hide-hostname="true" lazy-rendering' \
|
||||||
-p $(SWAGGER_DOCS_PORT):80 \
|
-p $(SWAGGER_DOCS_PORT):80 \
|
||||||
bfirsh/redoc:1.14.0
|
bfirsh/redoc:1.14.0
|
||||||
|
|
||||||
.PHONY: buildx
|
|
||||||
ifdef USE_BUILDX
|
|
||||||
ifeq ($(BUILDX), bundles/buildx)
|
|
||||||
buildx: bundles/buildx ## build buildx cli tool
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
bundles/buildx: bundles ## build buildx CLI tool
|
|
||||||
curl -fsSL https://raw.githubusercontent.com/moby/buildkit/70deac12b5857a1aa4da65e90b262368e2f71500/hack/install-buildx | VERSION="$(BUILDX_VERSION)" BINDIR="$(@D)" bash
|
|
||||||
$@ version
|
|
||||||
|
|||||||
Reference in New Issue
Block a user