add docker-buildx-plugin package (deb, rpm)
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
Родитель
de92dc5018
Коммит
37aa0a7cf4
12
Makefile
12
Makefile
|
@ -15,7 +15,7 @@ clean-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
|
||||
src: src/github.com/docker/cli src/github.com/docker/docker src/github.com/docker/buildx src/github.com/docker/compose src/github.com/docker/scan-cli-plugin ## clone source
|
||||
|
||||
ifdef CLI_DIR
|
||||
src/github.com/docker/cli:
|
||||
|
@ -37,6 +37,10 @@ src/github.com/docker/docker:
|
|||
git -C $@ remote add origin "$(DOCKER_ENGINE_REPO)"
|
||||
endif
|
||||
|
||||
src/github.com/docker/buildx:
|
||||
git init $@
|
||||
git -C $@ remote add origin "$(DOCKER_BUILDX_REPO)"
|
||||
|
||||
src/github.com/docker/compose:
|
||||
git init $@
|
||||
git -C $@ remote add origin "$(DOCKER_COMPOSE_REPO)"
|
||||
|
@ -54,6 +58,10 @@ checkout-cli: src/github.com/docker/cli
|
|||
checkout-docker: src/github.com/docker/docker
|
||||
./scripts/checkout.sh src/github.com/docker/docker "$(DOCKER_ENGINE_REF)"
|
||||
|
||||
.PHONY: checkout-buildx
|
||||
checkout-buildx: src/github.com/docker/buildx
|
||||
./scripts/checkout.sh src/github.com/docker/buildx "$(DOCKER_BUILDX_REF)"
|
||||
|
||||
.PHONY: checkout-compose
|
||||
checkout-compose: src/github.com/docker/compose
|
||||
./scripts/checkout.sh src/github.com/docker/compose "$(DOCKER_COMPOSE_REF)"
|
||||
|
@ -63,7 +71,7 @@ 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)
|
||||
checkout: checkout-cli checkout-docker checkout-buildx checkout-compose checkout-scan-cli-plugin ## checkout source at the given reference(s)
|
||||
|
||||
.PHONY: clean
|
||||
clean: clean-src ## remove build artifacts
|
||||
|
|
|
@ -28,6 +28,7 @@ DOCKER_CLI_REPO ?= https://github.com/docker/cli.git
|
|||
DOCKER_ENGINE_REPO ?= https://github.com/docker/docker.git
|
||||
DOCKER_SCAN_REPO ?= https://github.com/docker/scan-cli-plugin.git
|
||||
DOCKER_COMPOSE_REPO ?= https://github.com/docker/compose.git
|
||||
DOCKER_BUILDX_REPO ?= https://github.com/docker/buildx.git
|
||||
|
||||
# REF can be used to specify the same branch or tag to use for *both* the CLI
|
||||
# and Engine source code. This can be useful if both the CLI and Engine have a
|
||||
|
@ -40,6 +41,7 @@ DOCKER_CLI_REF ?= $(REF)
|
|||
DOCKER_ENGINE_REF ?= $(REF)
|
||||
DOCKER_SCAN_REF ?= v0.17.0
|
||||
DOCKER_COMPOSE_REF ?= v2.3.4
|
||||
DOCKER_BUILDX_REF ?= v0.8.1
|
||||
|
||||
export BUILDTIME
|
||||
export DEFAULT_PRODUCT_LICENSE
|
||||
|
|
11
deb/Makefile
11
deb/Makefile
|
@ -33,6 +33,7 @@ RUN?=docker run --rm \
|
|||
-e VERSION=$(word 2, $(GEN_DEB_VER)) \
|
||||
-e CLI_GITCOMMIT=$(CLI_GITCOMMIT) \
|
||||
-e ENGINE_GITCOMMIT=$(ENGINE_GITCOMMIT) \
|
||||
-e BUILDX_VERSION=$(DOCKER_BUILDX_REF) \
|
||||
-e COMPOSE_VERSION=$(DOCKER_COMPOSE_REF) \
|
||||
-e SCAN_VERSION=$(DOCKER_SCAN_REF) \
|
||||
-e SCAN_GITCOMMIT=$(SCAN_GITCOMMIT) \
|
||||
|
@ -78,7 +79,7 @@ $(DISTROS): sources
|
|||
$(CHOWN) -R $(shell id -u):$(shell id -g) "debbuild/$@"
|
||||
|
||||
.PHONY: sources
|
||||
sources: sources/cli.tgz sources/engine.tgz sources/compose.tgz sources/scan-cli-plugin.tgz sources/plugin-installers.tgz
|
||||
sources: sources/cli.tgz sources/engine.tgz sources/buildx.tgz sources/compose.tgz sources/scan-cli-plugin.tgz sources/plugin-installers.tgz
|
||||
|
||||
sources/engine.tgz:
|
||||
mkdir -p $(@D)
|
||||
|
@ -96,6 +97,14 @@ sources/cli.tgz:
|
|||
alpine \
|
||||
tar -C / -c -z -f /v/cli.tgz --exclude .git cli
|
||||
|
||||
sources/buildx.tgz:
|
||||
mkdir -p $(@D)
|
||||
docker run --rm -w /v \
|
||||
-v $(realpath $(CURDIR)/../src/github.com/docker/buildx):/buildx \
|
||||
-v $(CURDIR)/$(@D):/v \
|
||||
alpine \
|
||||
tar -C / -c -z -f /v/buildx.tgz --exclude .git buildx
|
||||
|
||||
sources/compose.tgz:
|
||||
mkdir -p $(@D)
|
||||
docker run --rm -w /v \
|
||||
|
|
|
@ -7,6 +7,8 @@ mkdir -p /root/build-deb/engine
|
|||
tar -C /root/build-deb -xzf /sources/engine.tgz
|
||||
mkdir -p /root/build-deb/cli
|
||||
tar -C /root/build-deb -xzf /sources/cli.tgz
|
||||
mkdir -p /root/build-deb/buildx
|
||||
tar -C /root/build-deb -xzf /sources/buildx.tgz
|
||||
mkdir -p /root/build-deb/compose
|
||||
tar -C /root/build-deb -xzf /sources/compose.tgz
|
||||
mkdir -p /root/build-deb/scan-cli-plugin
|
||||
|
@ -16,6 +18,7 @@ tar -C /root/build-deb -xzf /sources/scan-cli-plugin.tgz
|
|||
mkdir -p /go/src/github.com/docker
|
||||
ln -snf /root/build-deb/engine /go/src/github.com/docker/docker
|
||||
ln -snf /root/build-deb/cli /go/src/github.com/docker/cli
|
||||
ln -snf /root/build-deb/buildx /go/src/github.com/docker/buildx
|
||||
ln -snf /root/build-deb/compose /go/src/github.com/docker/compose
|
||||
ln -snf /root/build-deb/scan-cli-plugin /go/src/github.com/docker/scan-cli-plugin
|
||||
|
||||
|
|
|
@ -63,7 +63,8 @@ Package: docker-ce-cli
|
|||
Architecture: linux-any
|
||||
Depends: ${shlibs:Depends}
|
||||
# TODO change once we support scan-plugin on other architectures
|
||||
Recommends: docker-compose-plugin,
|
||||
Recommends: docker-buildx-plugin,
|
||||
docker-compose-plugin,
|
||||
docker-scan-plugin [amd64]
|
||||
Conflicts: docker (<< 1.5~),
|
||||
docker-engine,
|
||||
|
@ -103,6 +104,14 @@ Description: Rootless support for Docker.
|
|||
Either VPNKit or slirp4netns (>= 0.4.0) needs to be installed separately.
|
||||
Homepage: https://docs.docker.com/engine/security/rootless/
|
||||
|
||||
Package: docker-buildx-plugin
|
||||
Priority: optional
|
||||
Replaces: docker-ce-cli
|
||||
Architecture: linux-any
|
||||
Enhances: docker-ce-cli
|
||||
Description: Docker Buildx cli plugin.
|
||||
Homepage: https://github.com/docker/buildx
|
||||
|
||||
Package: docker-compose-plugin
|
||||
Priority: optional
|
||||
Architecture: linux-any
|
||||
|
|
|
@ -16,6 +16,11 @@ override_dh_auto_build:
|
|||
# Build the CLI
|
||||
cd /go/src/github.com/docker/cli && VERSION=$(VERSION) GITCOMMIT=$(CLI_GITCOMMIT) LDFLAGS='' GO_LINKMODE=dynamic ./scripts/build/binary && DISABLE_WARN_OUTSIDE_CONTAINER=1 LDFLAGS='' make manpages
|
||||
|
||||
# Build buildx plugin
|
||||
cd /go/src/github.com/docker/buildx \
|
||||
&& mkdir -p /usr/libexec/docker/cli-plugins/ \
|
||||
&& CGO_ENABLED=0 GO111MODULE=on go build -mod=vendor -o /usr/libexec/docker/cli-plugins/docker-buildx -ldflags "-X github.com/docker/buildx/version.Version=$(BUILDX_VERSION) -X github.com/docker/buildx/version.Revision=$(git rev-parse HEAD) -X github.com/docker/buildx/version.Package=github.com/docker/buildx" ./cmd/buildx
|
||||
|
||||
# Build the compose plugin
|
||||
# FIXME: using GOPROXY, to work around:
|
||||
# go: github.com/Azure/azure-sdk-for-go@v48.2.0+incompatible: reading github.com/Azure/azure-sdk-for-go/go.mod at revision v48.2.0: unknown revision v48.2.0
|
||||
|
@ -49,6 +54,9 @@ override_dh_auto_test:
|
|||
ver="$$(cli/build/docker --version)"; \
|
||||
test "$$ver" = "Docker version $(VERSION), build $(CLI_GITCOMMIT)" && echo "PASS: cli version OK" || (echo "FAIL: cli version ($$ver) did not match" && exit 1)
|
||||
|
||||
ver="$$(/usr/libexec/docker/cli-plugins/docker-buildx docker-cli-plugin-metadata | awk '{ gsub(/[",:]/,"")}; $$1 == "Version" { print $$2 }')"; \
|
||||
test "$$ver" = "$(BUILDX_VERSION)" && echo "PASS: docker-buildx version OK" || (echo "FAIL: docker-buildx version ($$ver) did not match" && exit 1)
|
||||
|
||||
ver="$$(/usr/libexec/docker/cli-plugins/docker-compose docker-cli-plugin-metadata | awk '{ gsub(/[",:]/,"")}; $$1 == "Version" { print $$2 }')"; \
|
||||
test "$$ver" = "$(COMPOSE_VERSION)" && echo "PASS: docker-compose version OK" || (echo "FAIL: docker-compose version ($$ver) did not match" && exit 1)
|
||||
|
||||
|
@ -81,6 +89,9 @@ override_dh_auto_install:
|
|||
install -D -m 0755 $(shell readlink -e engine/bundles/dynbinary-daemon/docker-proxy) debian/docker-ce/usr/bin/docker-proxy
|
||||
install -D -m 0755 /usr/local/bin/docker-init debian/docker-ce/usr/bin/docker-init
|
||||
|
||||
# docker-buildx-plugin install
|
||||
install -D -m 0755 /usr/libexec/docker/cli-plugins/docker-buildx debian/docker-buildx-plugin/usr/libexec/docker/cli-plugins/docker-buildx
|
||||
|
||||
# docker-compose-plugin install
|
||||
install -D -m 0755 /usr/libexec/docker/cli-plugins/docker-compose debian/docker-compose-plugin/usr/libexec/docker/cli-plugins/docker-compose
|
||||
|
||||
|
@ -110,6 +121,10 @@ override_dh_install:
|
|||
dh_apparmor --profile-name=docker-ce -pdocker-ce
|
||||
|
||||
override_dh_gencontrol:
|
||||
# Use separate version for the buildx-plugin package, then generate the other control files as usual
|
||||
# TODO override "Source" field in control as well (to point to buildx, as it doesn't match the package name)
|
||||
dh_gencontrol -pdocker-buildx-plugin -- -v$${BUILDX_VERSION#v}~$${DISTRO}-$${SUITE}
|
||||
|
||||
# Use separate version for the compose-plugin package, then generate the other control files as usual
|
||||
# TODO override "Source" field in control as well (to point to compose, as it doesn't match the package name)
|
||||
dh_gencontrol -pdocker-compose-plugin -- -v$${COMPOSE_VERSION#v}~$${DISTRO}-$${SUITE}
|
||||
|
|
17
rpm/Makefile
17
rpm/Makefile
|
@ -4,6 +4,7 @@ PLUGINS_DIR=$(realpath $(CURDIR)/../plugins)
|
|||
GO_BASE_IMAGE=golang
|
||||
GO_IMAGE?=$(GO_BASE_IMAGE):$(GO_VERSION)-buster
|
||||
GEN_RPM_VER=$(shell ./gen-rpm-ver $(realpath $(CURDIR)/../src/github.com/docker/cli) "$(VERSION)")
|
||||
GEN_BUILDX_RPM_VER=$(shell ./gen-rpm-ver $(realpath $(CURDIR)/../src/github.com/docker/buildx) "$(DOCKER_BUILDX_REF)")
|
||||
GEN_COMPOSE_RPM_VER=$(shell ./gen-rpm-ver $(realpath $(CURDIR)/../src/github.com/docker/compose) "$(DOCKER_COMPOSE_REF)")
|
||||
GEN_SCAN_RPM_VER=$(shell ./gen-rpm-ver $(realpath $(CURDIR)/../src/github.com/docker/scan-cli-plugin) "$(DOCKER_SCAN_REF)")
|
||||
CLI_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/cli) && git rev-parse --short HEAD)
|
||||
|
@ -23,9 +24,9 @@ BUILD?=DOCKER_BUILDKIT=1 \
|
|||
|
||||
|
||||
ifeq ($(ARCH),x86_64)
|
||||
SPEC_FILES?=docker-ce.spec docker-ce-cli.spec docker-ce-rootless-extras.spec docker-compose-plugin.spec docker-scan-plugin.spec
|
||||
SPEC_FILES?=docker-ce.spec docker-ce-cli.spec docker-ce-rootless-extras.spec docker-buildx-plugin.spec docker-compose-plugin.spec docker-scan-plugin.spec
|
||||
else
|
||||
SPEC_FILES?=docker-ce.spec docker-ce-cli.spec docker-ce-rootless-extras.spec docker-compose-plugin.spec
|
||||
SPEC_FILES?=docker-ce.spec docker-ce-cli.spec docker-ce-rootless-extras.spec docker-buildx-plugin.spec docker-compose-plugin.spec
|
||||
endif
|
||||
|
||||
SPECS?=$(addprefix SPECS/, $(SPEC_FILES))
|
||||
|
@ -35,6 +36,8 @@ RPMBUILD_FLAGS?=-ba\
|
|||
--define '_release $(word 2,$(GEN_RPM_VER))' \
|
||||
--define '_version $(word 1,$(GEN_RPM_VER))' \
|
||||
--define '_origversion $(word 4, $(GEN_RPM_VER))' \
|
||||
--define '_buildx_rpm_version $(word 1,$(GEN_BUILDX_RPM_VER))' \
|
||||
--define '_buildx_version $(word 4,$(GEN_BUILDX_RPM_VER))' \
|
||||
--define '_compose_rpm_version $(word 1,$(GEN_COMPOSE_RPM_VER))' \
|
||||
--define '_compose_version $(word 4,$(GEN_COMPOSE_RPM_VER))' \
|
||||
--define '_scan_rpm_version $(word 1,$(GEN_SCAN_RPM_VER))' \
|
||||
|
@ -98,7 +101,7 @@ $(DISTROS): sources
|
|||
$(CHOWN) -R $(shell id -u):$(shell id -g) "rpmbuild/$@"
|
||||
|
||||
.PHONY: sources
|
||||
sources: rpmbuild/SOURCES/engine.tgz rpmbuild/SOURCES/cli.tgz rpmbuild/SOURCES/compose.tgz rpmbuild/SOURCES/scan-cli-plugin.tgz rpmbuild/SOURCES/plugin-installers.tgz
|
||||
sources: rpmbuild/SOURCES/engine.tgz rpmbuild/SOURCES/cli.tgz rpmbuild/SOURCES/buildx.tgz rpmbuild/SOURCES/compose.tgz rpmbuild/SOURCES/scan-cli-plugin.tgz rpmbuild/SOURCES/plugin-installers.tgz
|
||||
|
||||
rpmbuild/SOURCES/engine.tgz:
|
||||
mkdir -p $(@D)
|
||||
|
@ -116,6 +119,14 @@ rpmbuild/SOURCES/cli.tgz:
|
|||
alpine \
|
||||
tar -C / -c -z -f /v/cli.tgz --exclude .git cli
|
||||
|
||||
rpmbuild/SOURCES/buildx.tgz:
|
||||
mkdir -p $(@D)
|
||||
docker run --rm -w /v \
|
||||
-v $(realpath $(CURDIR)/../src/github.com/docker/buildx):/buildx \
|
||||
-v $(CURDIR)/$(@D):/v \
|
||||
alpine \
|
||||
tar -C / -c -z -f /v/buildx.tgz --exclude .git buildx
|
||||
|
||||
rpmbuild/SOURCES/compose.tgz:
|
||||
mkdir -p $(@D)
|
||||
docker run --rm -w /v \
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
%global debug_package %{nil}
|
||||
|
||||
Name: docker-buildx-plugin
|
||||
Version: %{_buildx_rpm_version}
|
||||
Release: %{_release}%{?dist}
|
||||
Epoch: 0
|
||||
Source0: buildx.tgz
|
||||
Summary: Docker Buildx plugin for the Docker CLI
|
||||
Group: Tools/Docker
|
||||
License: ASL 2.0
|
||||
URL: https://github.com/docker/buildx
|
||||
Vendor: Docker
|
||||
Packager: Docker <support@docker.com>
|
||||
|
||||
BuildRequires: bash
|
||||
|
||||
%description
|
||||
Docker Buildx plugin for the Docker CLI.
|
||||
|
||||
%prep
|
||||
%setup -q -c -n src -a 0
|
||||
|
||||
%build
|
||||
pushd ${RPM_BUILD_DIR}/src/buildx
|
||||
bash -c 'CGO_ENABLED=0 GO111MODULE=on go build -mod=vendor -o bin/docker-buildx -ldflags "-X github.com/docker/buildx/version.Version=%{_buildx_version} -X github.com/docker/buildx/version.Revision=%{_buildx_gitcommit} -X github.com/docker/buildx/version.Package=github.com/docker/buildx" ./cmd/buildx'
|
||||
popd
|
||||
|
||||
%check
|
||||
ver="$(${RPM_BUILD_ROOT}%{_libexecdir}/docker/cli-plugins/docker-buildx docker-cli-plugin-metadata | awk '{ gsub(/[",:]/,"")}; $1 == "Version" { print $2 }')"; \
|
||||
test "$ver" = "%{_buildx_version}" && echo "PASS: docker-buildx version OK" || (echo "FAIL: docker-buildx version ($ver) did not match" && exit 1)
|
||||
|
||||
%install
|
||||
pushd ${RPM_BUILD_DIR}/src/buildx
|
||||
install -D -p -m 0755 bin/docker-buildx ${RPM_BUILD_ROOT}%{_libexecdir}/docker/cli-plugins/docker-buildx
|
||||
popd
|
||||
|
||||
%files
|
||||
%{_libexecdir}/docker/cli-plugins/docker-buildx
|
||||
|
||||
%post
|
||||
|
||||
%preun
|
||||
|
||||
%postun
|
||||
|
||||
%changelog
|
|
@ -22,8 +22,10 @@ Requires: /usr/sbin/groupadd
|
|||
# Note that we're not using <= 7 here, to account for other RPM distros, such
|
||||
# as Fedora, which would not have the rhel macro set (so default to 0).
|
||||
%if 0%{?rhel} == 7
|
||||
Requires: docker-buildx-plugin
|
||||
Requires: docker-compose-plugin
|
||||
%else
|
||||
Recommends: docker-buildx-plugin
|
||||
Recommends: docker-compose-plugin
|
||||
%endif
|
||||
|
||||
|
@ -128,7 +130,6 @@ done
|
|||
%files
|
||||
%doc build-docs/LICENSE build-docs/MAINTAINERS build-docs/NOTICE build-docs/README.md
|
||||
%{_bindir}/docker
|
||||
%{_libexecdir}/docker/cli-plugins/*
|
||||
%{_datadir}/bash-completion/completions/docker
|
||||
%{_datadir}/zsh/vendor-completions/_docker
|
||||
%{_datadir}/fish/vendor_completions.d/docker.fish
|
||||
|
|
|
@ -35,6 +35,7 @@ RUN \
|
|||
yum-builddep -y /root/rpmbuild/SPECS/*.spec; \
|
||||
else \
|
||||
yum-builddep -y /root/rpmbuild/SPECS/docker-c*.spec; \
|
||||
yum-builddep -y /root/rpmbuild/SPECS/docker-b*.spec; \
|
||||
fi
|
||||
|
||||
COPY --from=golang /usr/local/go /usr/local/go
|
||||
|
|
|
@ -38,6 +38,7 @@ RUN \
|
|||
yum-builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/*.spec; \
|
||||
else \
|
||||
yum-builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/docker-c*.spec; \
|
||||
yum-builddep --define '_without_btrfs 1' -y /root/rpmbuild/SPECS/docker-b*.spec; \
|
||||
fi
|
||||
|
||||
COPY --from=golang /usr/local/go /usr/local/go
|
||||
|
|
|
@ -26,6 +26,7 @@ RUN \
|
|||
dnf builddep -y /root/rpmbuild/SPECS/*.spec; \
|
||||
else \
|
||||
dnf builddep -y /root/rpmbuild/SPECS/docker-c*.spec; \
|
||||
dnf builddep -y /root/rpmbuild/SPECS/docker-b*.spec; \
|
||||
fi
|
||||
|
||||
COPY --from=golang /usr/local/go /usr/local/go
|
||||
|
|
|
@ -26,6 +26,7 @@ RUN \
|
|||
dnf builddep -y /root/rpmbuild/SPECS/*.spec; \
|
||||
else \
|
||||
dnf builddep -y /root/rpmbuild/SPECS/docker-c*.spec; \
|
||||
dnf builddep -y /root/rpmbuild/SPECS/docker-b*.spec; \
|
||||
fi
|
||||
|
||||
COPY --from=golang /usr/local/go /usr/local/go
|
||||
|
|
|
@ -26,6 +26,7 @@ RUN \
|
|||
dnf builddep -y /root/rpmbuild/SPECS/*.spec; \
|
||||
else \
|
||||
dnf builddep -y /root/rpmbuild/SPECS/docker-c*.spec; \
|
||||
dnf builddep -y /root/rpmbuild/SPECS/docker-b*.spec; \
|
||||
fi
|
||||
|
||||
COPY --from=golang /usr/local/go /usr/local/go
|
||||
|
|
|
@ -31,6 +31,7 @@ RUN \
|
|||
yum-builddep -y /root/rpmbuild/SPECS/*.spec; \
|
||||
else \
|
||||
yum-builddep -y /root/rpmbuild/SPECS/docker-c*.spec; \
|
||||
yum-builddep -y /root/rpmbuild/SPECS/docker-b*.spec; \
|
||||
fi
|
||||
|
||||
COPY --from=golang /usr/local/go /usr/local/go
|
||||
|
|
Загрузка…
Ссылка в новой задаче