Skip to content

Commit d6debae

Browse files
committed
Add docker-compose-plugin package
Adds a package for the docker-compose cli plugin with this: dpkg -i ./docker-ce-cli_0.0.0-20210629140245-4a6fe51-0~ubuntu-focal_amd64.deb dpkg -i ./docker-compose-plugin_2.0.0-beta.4~ubuntu-focal_amd64.deb docker info --format '{{json .ClientInfo.Plugins}}' | jq . [ { "SchemaVersion": "0.1.0", "Vendor": "Docker Inc.", "Version": "v0.5.1-docker", "ShortDescription": "Build with BuildKit", "Name": "buildx", "Path": "/usr/libexec/docker/cli-plugins/docker-buildx" }, { "SchemaVersion": "0.1.0", "Vendor": "Docker Inc.", "Version": "2.0.0-beta.4", "ShortDescription": "Docker Compose", "Name": "compose", "Path": "/usr/libexec/docker/cli-plugins/docker-compose" } ] Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 09541b5 commit d6debae

File tree

7 files changed

+56
-7
lines changed

7 files changed

+56
-7
lines changed

Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ clean-src:
1515
$(RM) -r src
1616

1717
.PHONY: src
18-
src: src/github.com/docker/cli src/github.com/docker/docker src/github.com/docker/scan-cli-plugin ## clone source
18+
src: src/github.com/docker/cli src/github.com/docker/docker src/github.com/docker/compose-cli src/github.com/docker/scan-cli-plugin ## clone source
1919

2020
ifdef CLI_DIR
2121
src/github.com/docker/cli:
@@ -37,6 +37,10 @@ src/github.com/docker/docker:
3737
git -C $@ remote add origin "$(DOCKER_ENGINE_REPO)"
3838
endif
3939

40+
src/github.com/docker/compose-cli:
41+
git init $@
42+
git -C $@ remote add origin "$(DOCKER_COMPOSE_REPO)"
43+
4044
src/github.com/docker/scan-cli-plugin:
4145
git init $@
4246
git -C $@ remote add origin "$(DOCKER_SCAN_REPO)"
@@ -50,12 +54,16 @@ checkout-cli: src/github.com/docker/cli
5054
checkout-docker: src/github.com/docker/docker
5155
./scripts/checkout.sh src/github.com/docker/docker "$(DOCKER_ENGINE_REF)"
5256

57+
.PHONY: checkout-compose-cli
58+
checkout-compose-cli: src/github.com/docker/compose-cli
59+
./scripts/checkout.sh src/github.com/docker/compose-cli "$(DOCKER_COMPOSE_REF)"
60+
5361
.PHONY: checkout-scan-cli-plugin
5462
checkout-scan-cli-plugin: src/github.com/docker/scan-cli-plugin
5563
./scripts/checkout.sh src/github.com/docker/scan-cli-plugin "$(DOCKER_SCAN_REF)"
5664

5765
.PHONY: checkout
58-
checkout: checkout-cli checkout-docker checkout-scan-cli-plugin ## checkout source at the given reference(s)
66+
checkout: checkout-cli checkout-docker checkout-compose-cli checkout-scan-cli-plugin ## checkout source at the given reference(s)
5967

6068
.PHONY: clean
6169
clean: clean-src ## remove build artifacts

common.mk

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ VERSION?=0.0.1-dev
2323

2424
# DOCKER_CLI_REPO and DOCKER_ENGINE_REPO define the source repositories to clone
2525
# the source from. These can be overridden to build from a fork.
26-
DOCKER_CLI_REPO ?= https://github.com/docker/cli.git
27-
DOCKER_ENGINE_REPO ?= https://github.com/docker/docker.git
28-
DOCKER_SCAN_REPO ?= https://github.com/docker/scan-cli-plugin.git
26+
DOCKER_CLI_REPO ?= https://github.com/docker/cli.git
27+
DOCKER_ENGINE_REPO ?= https://github.com/docker/docker.git
28+
DOCKER_SCAN_REPO ?= https://github.com/docker/scan-cli-plugin.git
29+
DOCKER_COMPOSE_REPO ?= https://github.com/docker/compose-cli.git
2930

3031
# REF can be used to specify the same branch or tag to use for *both* the CLI
3132
# and Engine source code. This can be useful if both the CLI and Engine have a
@@ -37,6 +38,7 @@ REF ?= HEAD
3738
DOCKER_CLI_REF ?= $(REF)
3839
DOCKER_ENGINE_REF ?= $(REF)
3940
DOCKER_SCAN_REF ?= v0.8.0
41+
DOCKER_COMPOSE_REF ?= v2.0.0-beta.4
4042

4143
export BUILDTIME
4244
export DEFAULT_PRODUCT_LICENSE

deb/Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ RUN?=docker run --rm \
3333
-e VERSION=$(word 2, $(GEN_DEB_VER)) \
3434
-e CLI_GITCOMMIT=$(CLI_GITCOMMIT) \
3535
-e ENGINE_GITCOMMIT=$(ENGINE_GITCOMMIT) \
36+
-e COMPOSE_VERSION=$(DOCKER_COMPOSE_REF) \
3637
-e SCAN_VERSION=$(DOCKER_SCAN_REF) \
3738
-e SCAN_GITCOMMIT=$(SCAN_GITCOMMIT) \
3839
-v $(CURDIR)/debbuild/$@:/build \
@@ -77,7 +78,7 @@ $(DISTROS): sources
7778
$(CHOWN) -R $(shell id -u):$(shell id -g) "debbuild/$@"
7879

7980
.PHONY: sources
80-
sources: sources/cli.tgz sources/engine.tgz sources/scan-cli-plugin.tgz sources/plugin-installers.tgz
81+
sources: sources/cli.tgz sources/engine.tgz sources/compose-cli.tgz sources/scan-cli-plugin.tgz sources/plugin-installers.tgz
8182

8283
sources/engine.tgz:
8384
mkdir -p $(@D)
@@ -95,6 +96,14 @@ sources/cli.tgz:
9596
alpine \
9697
tar -C / -c -z -f /v/cli.tgz --exclude .git cli
9798

99+
sources/compose-cli.tgz:
100+
mkdir -p $(@D)
101+
docker run --rm -w /v \
102+
-v $(realpath $(CURDIR)/../src/github.com/docker/compose-cli):/compose-cli \
103+
-v $(CURDIR)/$(@D):/v \
104+
alpine \
105+
tar -C / -c -z -f /v/compose-cli.tgz --exclude .git compose-cli
106+
98107
sources/scan-cli-plugin.tgz:
99108
mkdir -p $(@D)
100109
docker run --rm -w /v \

deb/build-deb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ mkdir -p /root/build-deb/engine
77
tar -C /root/build-deb -xzf /sources/engine.tgz
88
mkdir -p /root/build-deb/cli
99
tar -C /root/build-deb -xzf /sources/cli.tgz
10+
mkdir -p /root/build-deb/compose-cli
11+
tar -C /root/build-deb -xzf /sources/compose-cli.tgz
1012
mkdir -p /root/build-deb/scan-cli-plugin
1113
tar -C /root/build-deb -xzf /sources/scan-cli-plugin.tgz
1214

1315
# link them to their canonical path
1416
mkdir -p /go/src/github.com/docker
1517
ln -snf /root/build-deb/engine /go/src/github.com/docker/docker
1618
ln -snf /root/build-deb/cli /go/src/github.com/docker/cli
19+
ln -snf /root/build-deb/compose-cli /go/src/github.com/docker/compose-cli
1720
ln -snf /root/build-deb/scan-cli-plugin /go/src/github.com/docker/scan-cli-plugin
1821

1922
EPOCH="${EPOCH:-}"

deb/common/control

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ Package: docker-ce-cli
6363
Architecture: linux-any
6464
Depends: ${shlibs:Depends}
6565
# TODO change once we support scan-plugin on other architectures
66-
Recommends: docker-scan-plugin [amd64]
66+
Recommends: docker-compose-plugin,
67+
docker-scan-plugin [amd64]
6768
Conflicts: docker (<< 1.5~),
6869
docker-engine,
6970
docker-engine-cs,
@@ -101,6 +102,13 @@ Description: Rootless support for Docker.
101102
Either VPNKit or slirp4netns (>= 0.4.0) needs to be installed separately.
102103
Homepage: https://docs.docker.com/engine/security/rootless/
103104

105+
Package: docker-compose-plugin
106+
Priority: optional
107+
Architecture: linux-any
108+
Enhances: docker-ce-cli
109+
Description: Docker compose cli plugin.
110+
Homepage: https://github.com/docker/compose-cli
111+
104112
Package: docker-scan-plugin
105113
Priority: optional
106114
# TODO change once we support scan-plugin on other architectures (see dpkg-architecture -L)

deb/common/rules

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ override_dh_auto_build:
1111
# Build the CLI
1212
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
1313

14+
# Build the compose-cli plugin
15+
# FIXME: using GOPROXY, to work around:
16+
# go: github.com/Azure/[email protected]+incompatible: reading github.com/Azure/azure-sdk-for-go/go.mod at revision v48.2.0: unknown revision v48.2.0
17+
cd /go/src/github.com/docker/compose-cli \
18+
&& GOPROXY="https://proxy.golang.org" GO111MODULE=on go mod download \
19+
&& mkdir -p /usr/libexec/docker/cli-plugins/ \
20+
&& GOPROXY="https://proxy.golang.org" GO111MODULE=on GIT_TAG=$(COMPOSE_VERSION) \
21+
make COMPOSE_BINARY=/usr/libexec/docker/cli-plugins/docker-compose -f builder.Makefile compose-plugin
22+
1423
# Build the scan-plugin
1524
# TODO change once we support scan-plugin on other architectures
1625
if [ "$(TARGET_ARCH)" = "amd64" ]; then \
@@ -54,6 +63,9 @@ override_dh_auto_install:
5463
install -D -m 0755 $(shell readlink -e engine/bundles/dynbinary-daemon/docker-proxy) debian/docker-ce/usr/bin/docker-proxy
5564
install -D -m 0755 /usr/local/bin/docker-init debian/docker-ce/usr/bin/docker-init
5665

66+
# docker-compose-plugin install
67+
install -D -m 0755 /usr/libexec/docker/cli-plugins/docker-compose debian/docker-compose-plugin/usr/libexec/docker/cli-plugins/docker-compose
68+
5769
# docker-scan-plugin install
5870
# TODO change once we support scan-plugin on other architectures
5971
if [ "$(TARGET_ARCH)" = "amd64" ]; then \
@@ -80,6 +92,10 @@ override_dh_install:
8092
dh_apparmor --profile-name=docker-ce -pdocker-ce
8193

8294
override_dh_gencontrol:
95+
# Use separate version for the compose-plugin package, then generate the other control files as usual
96+
# TODO override "Source" field in control as well (to point to compose-cli, as it doesn't match the package name)
97+
dh_gencontrol -pdocker-compose-plugin -- -v$${COMPOSE_VERSION#v}~$${DISTRO}-$${SUITE}; \
98+
8399
# Use separate version for the scan-plugin package, then generate the other control files as usual
84100
# TODO override "Source" field in control as well (to point to scan-cli-plugin, as it doesn't match the package name)
85101
# TODO change once we support scan-plugin on other architectures (see dpkg-architecture -L)

rpm/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ PLUGINS_DIR=$(realpath $(CURDIR)/../plugins)
44
GO_BASE_IMAGE=golang
55
GO_IMAGE?=$(GO_BASE_IMAGE):$(GO_VERSION)-buster
66
GEN_RPM_VER=$(shell ./gen-rpm-ver $(realpath $(CURDIR)/../src/github.com/docker/cli) "$(VERSION)")
7+
GEN_COMPOSE_RPM_VER=$(shell ./gen-rpm-ver $(realpath $(CURDIR)/../src/github.com/docker/compose-cli-plugin) "$(DOCKER_COMPOSE_REF)")
78
GEN_SCAN_RPM_VER=$(shell ./gen-rpm-ver $(realpath $(CURDIR)/../src/github.com/docker/scan-cli-plugin) "$(DOCKER_SCAN_REF)")
89
CLI_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/cli) && git rev-parse --short HEAD)
910
ENGINE_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/docker) && git rev-parse --short HEAD)
@@ -34,6 +35,8 @@ RPMBUILD_FLAGS?=-ba\
3435
--define '_release $(word 2,$(GEN_RPM_VER))' \
3536
--define '_version $(word 1,$(GEN_RPM_VER))' \
3637
--define '_origversion $(word 4, $(GEN_RPM_VER))' \
38+
--define '_compose_rpm_version $(word 1,$(GEN_COMPOSE_RPM_VER))' \
39+
--define '_compose_version $(word 4,$(GEN_COMPOSE_RPM_VER))' \
3740
--define '_scan_rpm_version $(word 1,$(GEN_SCAN_RPM_VER))' \
3841
--define '_scan_version $(word 4,$(GEN_SCAN_RPM_VER))' \
3942
--define '_scan_gitcommit $(SCAN_GITCOMMIT)' \

0 commit comments

Comments
 (0)