Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/buildx src/github.com/docker/compose ## 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/model-cli ## clone source

ifdef CLI_DIR
src/github.com/docker/cli:
Expand Down Expand Up @@ -45,6 +45,10 @@ src/github.com/docker/compose:
git init $@
git -C $@ remote add origin "$(DOCKER_COMPOSE_REPO)"

src/github.com/docker/model-cli:
git init $@
git -C $@ remote add origin "$(DOCKER_MODEL_REPO)"

.PHONY: checkout-cli
checkout-cli: src/github.com/docker/cli
./scripts/checkout.sh src/github.com/docker/cli "$(DOCKER_CLI_REF)"
Expand All @@ -61,8 +65,12 @@ checkout-buildx: src/github.com/docker/buildx
checkout-compose: src/github.com/docker/compose
./scripts/checkout.sh src/github.com/docker/compose "$(DOCKER_COMPOSE_REF)"

.PHONY: checkout-model
checkout-model: src/github.com/docker/model-cli
./scripts/checkout.sh src/github.com/docker/model-cli "$(DOCKER_MODEL_REF)"

.PHONY: checkout
checkout: checkout-cli checkout-docker checkout-buildx checkout-compose ## checkout source at the given reference(s)
checkout: checkout-cli checkout-docker checkout-buildx checkout-compose checkout-model ## checkout source at the given reference(s)

.PHONY: clean
clean: clean-src ## remove build artifacts
Expand Down
4 changes: 4 additions & 0 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ DOCKER_CLI_REPO ?= https://github.com/docker/cli.git
DOCKER_ENGINE_REPO ?= https://github.com/docker/docker.git
DOCKER_COMPOSE_REPO ?= https://github.com/docker/compose.git
DOCKER_BUILDX_REPO ?= https://github.com/docker/buildx.git
DOCKER_MODEL_REPO ?= https://github.com/docker/model-cli.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
Expand All @@ -44,6 +45,9 @@ DOCKER_COMPOSE_REF ?= v2.35.1
# DOCKER_BUILDX_REF is the version of compose to package. It usually is a tag,
# but can be a valid git reference in DOCKER_BUILDX_REPO.
DOCKER_BUILDX_REF ?= v0.23.0
# DOCKER_MODEL_REF is the version of model to package. It is usually a tag,
# but can be a valid git reference in DOCKER_MODEL_REPO.
DOCKER_MODEL_REF ?= v0.1.23

# Use "stage" to install dependencies from download-stage.docker.com during the
# verify step. Leave empty or use any other value to install from download.docker.com
Expand Down
13 changes: 12 additions & 1 deletion deb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ EPOCH?=5
GEN_DEB_VER=$(shell ./gen-deb-ver $(realpath $(CURDIR)/../src/github.com/docker/cli) "$(VERSION)")
GEN_BUILDX_DEB_VER=$(shell ./gen-deb-ver $(realpath $(CURDIR)/../src/github.com/docker/buildx) "$(DOCKER_BUILDX_REF)")
GEN_COMPOSE_DEB_VER=$(shell ./gen-deb-ver $(realpath $(CURDIR)/../src/github.com/docker/compose) "$(DOCKER_COMPOSE_REF)")
GEN_MODEL_DEB_VER=$(shell ./gen-deb-ver $(realpath $(CURDIR)/../src/github.com/docker/model-cli) "$(DOCKER_MODEL_REF)")
CLI_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/cli) && git rev-parse --short HEAD)
ENGINE_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/docker) && git rev-parse --short HEAD)
BUILDX_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/buildx) && git rev-parse --short HEAD)
Expand Down Expand Up @@ -46,6 +47,8 @@ RUN?=docker run --rm \
-e BUILDX_GITCOMMIT=$(BUILDX_GITCOMMIT) \
-e COMPOSE_VERSION=$(DOCKER_COMPOSE_REF) \
-e COMPOSE_DEB_VERSION=$(word 1, $(GEN_COMPOSE_DEB_VER)) \
-e MODEL_VERSION=$(DOCKER_MODEL_REF) \
-e MODEL_DEB_VERSION=$(word 1, $(GEN_MODEL_DEB_VER)) \
-v $(CURDIR)/debbuild/$@:/build \
$(RUN_FLAGS) \
debbuild-$@/$(ARCH)
Expand Down Expand Up @@ -88,7 +91,7 @@ $(DISTROS): sources
$(CHOWN) -R $(shell id -u):$(shell id -g) "debbuild/$@"

.PHONY: sources
sources: sources/cli.tgz sources/engine.tgz sources/buildx.tgz sources/compose.tgz
sources: sources/cli.tgz sources/engine.tgz sources/buildx.tgz sources/compose.tgz sources/model.tgz

sources/engine.tgz:
mkdir -p $(@D)
Expand Down Expand Up @@ -122,6 +125,14 @@ sources/compose.tgz:
alpine \
tar -C / -c -z -f /v/compose.tgz --exclude .git compose

sources/model.tgz:
mkdir -p $(@D)
docker run --rm -w /v \
-v $(realpath $(CURDIR)/../src/github.com/docker/model-cli):/model \
-v $(CURDIR)/$(@D):/v \
alpine \
tar -C / -c -z -f /v/model.tgz --exclude .git model

# See ARCHES in common.mk. Could not figure out how to match both distro and arch.
BUNDLES:=$(addsuffix .tar.gz,$(addprefix debbuild/bundles-ce-%-,$(ARCHES)))

Expand Down
3 changes: 3 additions & 0 deletions deb/build-deb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ 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/model
tar -C /root/build-deb -xzf /sources/model.tgz

# link them to their canonical path
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/model /go/src/github.com/docker/model-cli

EPOCH="${EPOCH:-}"
EPOCH_SEP=""
Expand Down
10 changes: 10 additions & 0 deletions deb/common/control
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Architecture: linux-any
Depends: ${shlibs:Depends}
Recommends: docker-buildx-plugin,
docker-compose-plugin
Suggests: docker-model-plugin
Conflicts: docker (<< 1.5~),
docker-engine,
docker.io
Expand Down Expand Up @@ -113,3 +114,12 @@ Description: Docker Compose (V2) plugin for the Docker CLI.
The binary can also be run standalone as a direct replacement for
Docker Compose V1 ('docker-compose').
Homepage: https://github.com/docker/compose

Package: docker-model-plugin
Priority: optional
Architecture: linux-any
Enhances: docker-ce-cli
Description: Docker Model Runner plugin for the Docker CLI.
.
This plugin provides the 'docker model' subcommand.
Homepage: https://docs.docker.com/model-runner/
14 changes: 14 additions & 0 deletions deb/common/rules
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ override_dh_auto_build:
# Build the compose plugin
make -C /go/src/github.com/docker/compose VERSION=$(COMPOSE_VERSION) DESTDIR=/usr/libexec/docker/cli-plugins build

# Build the model plugin
GO111MODULE=on make -C /go/src/github.com/docker/model-cli VERSION=$(MODEL_VERSION) ce-release \
&& mv /go/src/github.com/docker/model-cli/dist/docker-model /usr/libexec/docker/cli-plugins/docker-model

override_dh_auto_test:
ver="$$(engine/bundles/dynbinary-daemon/dockerd --version)"; \
test "$$ver" = "Docker version $(VERSION), build $(ENGINE_GITCOMMIT)" && echo "PASS: daemon version OK" || (echo "FAIL: daemon version ($$ver) did not match" && exit 1)
Expand All @@ -60,6 +64,9 @@ override_dh_auto_test:
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)

ver="$$(/usr/libexec/docker/cli-plugins/docker-model docker-cli-plugin-metadata | awk '{ gsub(/[",:]/,"")}; $$1 == "Version" { print $$2 }')"; \
test "$$ver" = "$(MODEL_VERSION)" && echo "PASS: docker-model version OK" || (echo "FAIL: docker-model version ($$ver) did not match" && exit 1)

override_dh_strip:
# Go has lots of problems with stripping, so just don't

Expand Down Expand Up @@ -117,6 +124,9 @@ override_dh_auto_install:
# docker-compose-plugin install
install -D -p -m 0755 /usr/libexec/docker/cli-plugins/docker-compose debian/docker-compose-plugin/usr/libexec/docker/cli-plugins/docker-compose

# docker-model-plugin install
install -D -p -m 0755 /usr/libexec/docker/cli-plugins/docker-model debian/docker-model-plugin/usr/libexec/docker/cli-plugins/docker-model

# docker-ce-rootless-extras install
install -D -p -m 0755 /usr/local/bin/rootlesskit debian/docker-ce-rootless-extras/usr/bin/rootlesskit
install -D -p -m 0755 engine/contrib/dockerd-rootless.sh debian/docker-ce-rootless-extras/usr/bin/dockerd-rootless.sh
Expand Down Expand Up @@ -148,6 +158,10 @@ override_dh_gencontrol:
# 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_DEB_VERSION#v}-$${PKG_REVISION}~$${DISTRO}.$${VERSION_ID}~$${SUITE}

# Use separate version for the model-plugin package, then generate the other control files as usual
# TODO override "Source" field in control as well (to point to model, as it doesn't match the package name)
dh_gencontrol -pdocker-model-plugin -- -v$${MODEL_DEB_VERSION#v}-$${PKG_REVISION}~$${DISTRO}.$${VERSION_ID}~$${SUITE}

dh_gencontrol --remaining-packages

%:
Expand Down
15 changes: 13 additions & 2 deletions rpm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ GO_IMAGE?=$(GO_BASE_IMAGE):$(GO_VERSION)-bookworm
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_MODEL_RPM_VER=$(shell ./gen-rpm-ver $(realpath $(CURDIR)/../src/github.com/docker/model-cli) "$(DOCKER_MODEL_REF)")
CLI_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/cli) && git rev-parse --short HEAD)
ENGINE_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/docker) && git rev-parse --short HEAD)
BUILDX_GITCOMMIT?=$(shell cd $(realpath $(CURDIR)/../src/github.com/docker/buildx) && git rev-parse --short HEAD)
Expand All @@ -27,7 +28,7 @@ BUILD?=DOCKER_BUILDKIT=1 \
.


SPEC_FILES?=docker-ce.spec docker-ce-cli.spec docker-ce-rootless-extras.spec docker-buildx-plugin.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 docker-model-plugin.spec

SPECS?=$(addprefix SPECS/, $(SPEC_FILES))
RPMBUILD_FLAGS?=-ba\
Expand All @@ -41,6 +42,8 @@ RPMBUILD_FLAGS?=-ba\
--define '_buildx_gitcommit $(BUILDX_GITCOMMIT)' \
--define '_compose_rpm_version $(word 1,$(GEN_COMPOSE_RPM_VER))' \
--define '_compose_version $(word 4,$(GEN_COMPOSE_RPM_VER))' \
--define '_model_rpm_version $(word 1,$(GEN_MODEL_RPM_VER))' \
--define '_model_version $(word 4,$(GEN_MODEL_RPM_VER))' \
$(RPMBUILD_EXTRA_FLAGS) \
$(SPECS)

Expand Down Expand Up @@ -99,7 +102,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/buildx.tgz rpmbuild/SOURCES/compose.tgz
sources: rpmbuild/SOURCES/engine.tgz rpmbuild/SOURCES/cli.tgz rpmbuild/SOURCES/buildx.tgz rpmbuild/SOURCES/compose.tgz rpmbuild/SOURCES/model.tgz

rpmbuild/SOURCES/engine.tgz:
mkdir -p $(@D)
Expand Down Expand Up @@ -133,6 +136,14 @@ rpmbuild/SOURCES/compose.tgz:
alpine \
tar -C / -c -z -f /v/compose.tgz --exclude .git compose

rpmbuild/SOURCES/model.tgz:
mkdir -p $(@D)
docker run --rm -w /v \
-v $(realpath $(CURDIR)/../src/github.com/docker/model-cli):/model \
-v $(CURDIR)/$(@D):/v \
alpine \
tar -C / -c -z -f /v/model.tgz --exclude .git model

# See ARCHES in common.mk. Could not figure out how to match both distro and arch.
BUNDLES:=$(addsuffix .tar.gz,$(addprefix rpmbuild/bundles-ce-%-,$(ARCHES)))

Expand Down
2 changes: 2 additions & 0 deletions rpm/SPECS/docker-ce-cli.spec
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Requires: /usr/sbin/groupadd
Recommends: docker-buildx-plugin
Recommends: docker-compose-plugin

Suggests: docker-model-plugin

BuildRequires: make
BuildRequires: libtool-ltdl-devel
BuildRequires: git
Expand Down
52 changes: 52 additions & 0 deletions rpm/SPECS/docker-model-plugin.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
%global debug_package %{nil}

Name: docker-model-plugin
Version: %{_model_rpm_version}
Release: %{_release}%{?dist}
Epoch: 0
Source0: model.tgz
Summary: Docker Model Runner plugin for the Docker CLI
Group: Tools/Docker
License: Apache-2.0
URL: https://docs.docker.com/model-runner/
Vendor: Docker
Packager: Docker <support@docker.com>

Enhances: docker-ce-cli

BuildRequires: bash

%description
Docker Model Runner plugin for the Docker CLI.

This plugin provides the 'docker model' subcommand.

%prep
%setup -q -c -n src -a 0

%build
GO111MODULE=on make -C ${RPM_BUILD_DIR}/src/model VERSION=%{_model_version} ce-release

%check
ver="$(${RPM_BUILD_ROOT}%{_libexecdir}/docker/cli-plugins/docker-model docker-cli-plugin-metadata | awk '{ gsub(/[",:]/,"")}; $1 == "Version" { print $2 }')"; \
test "$ver" = "%{_model_version}" && echo "PASS: docker-model version OK" || (echo "FAIL: docker-model version ($ver) did not match" && exit 1)

%install
install -D -p -m 0755 ${RPM_BUILD_DIR}/src/model/dist/docker-model ${RPM_BUILD_ROOT}%{_libexecdir}/docker/cli-plugins/docker-model

for f in LICENSE; do
install -D -p -m 0644 "${RPM_BUILD_DIR}/src/model/$f" "docker-model-plugin-docs/$f"
done

%files
%doc docker-model-plugin-docs/*
%license docker-model-plugin-docs/LICENSE
%{_libexecdir}/docker/cli-plugins/docker-model

%post

%preun

%postun

%changelog
1 change: 1 addition & 0 deletions verify
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ function verify_binaries() {
docker --version
docker buildx version
docker compose version
docker model version
dockerd --version
docker-proxy --version
containerd --version
Expand Down