Skip to content

Commit 2918a25

Browse files
committed
static: split cli, engine, and containerd packages
This splits the CLI, Engine, and containerd packages to allow downloading the cli separate from the daemon, as well as (in future) allowing us to do a containerd release without also requiring an engine release. With this patch: make REF=v22.06.0-beta.0 VERSION=v22.06.0-beta.0 TARGETPLATFORM=linux/amd64 static static/build ├── bundles-ce-static-linux-x86_64.tar.gz └── linux └── amd64 ├── containerd-1.6.4.tgz ├── docker-buildx-plugin-0.8.2.tgz ├── docker-cli-22.06.0-beta.0.tgz ├── docker-engine-22.06.0-beta.0.tgz ├── docker-compose-plugin-2.6.1.tgz ├── docker-rootless-extras-22.06.0-beta.0.tgz └── docker-scan-plugin-0.17.0.tgz 2 directories, 8 files ls -lh static/build/linux/amd64/ total 215208 -rw-r--r-- 1 sebastiaan staff 31M Jun 29 00:21 containerd-1.6.4.tgz -rw-r--r-- 1 sebastiaan staff 14M Jun 29 00:21 docker-buildx-plugin-0.8.2.tgz -rw-r--r-- 1 sebastiaan staff 8.2M Jun 29 00:21 docker-cli-22.06.0-beta.0.tgz -rw-r--r-- 1 sebastiaan staff 19M Jun 29 00:21 docker-engine-22.06.0-beta.0.tgz -rw-r--r-- 1 sebastiaan staff 8.8M Jun 29 00:21 docker-compose-plugin-2.6.1.tgz -rw-r--r-- 1 sebastiaan staff 19M Jun 29 00:21 docker-rootless-extras-22.06.0-beta.0.tgz -rw-r--r-- 1 sebastiaan staff 4.4M Jun 29 00:21 docker-scan-plugin-0.17.0.tgz Signed-off-by: CrazyMax <[email protected]> Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 3d5e638 commit 2918a25

File tree

3 files changed

+77
-21
lines changed

3 files changed

+77
-21
lines changed

static/Makefile

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
include ../common.mk
22

3-
CLI_DIR=$(realpath $(CURDIR)/../src/github.com/docker/cli)
4-
ENGINE_DIR=$(realpath $(CURDIR)/../src/github.com/docker/docker)
5-
BUILDX_DIR=$(realpath $(CURDIR)/../src/github.com/docker/buildx)
6-
COMPOSE_DIR=$(realpath $(CURDIR)/../src/github.com/docker/compose)
7-
SCAN_DIR=$(realpath $(CURDIR)/../src/github.com/docker/scan-cli-plugin)
3+
CLI_DIR = $(realpath $(CURDIR)/../src/github.com/docker/cli)
4+
ENGINE_DIR = $(realpath $(CURDIR)/../src/github.com/docker/docker)
5+
BUILDX_DIR = $(realpath $(CURDIR)/../src/github.com/docker/buildx)
6+
COMPOSE_DIR = $(realpath $(CURDIR)/../src/github.com/docker/compose)
7+
SCAN_DIR = $(realpath $(CURDIR)/../src/github.com/docker/scan-cli-plugin)
8+
9+
CLI_VERSION = $(shell ./gen-static-ver $(CLI_DIR) $(VERSION))
10+
ENGINE_VERSION = $(shell ./gen-static-ver $(ENGINE_DIR) $(VERSION))
11+
CONTAINERD_PKG_VER = $(shell ./gen-containerd-ver $(ENGINE_DIR) $(CONTAINERD_VERSION))
812

9-
STATIC_VERSION=$(shell ./gen-static-ver $(CLI_DIR) $(VERSION))
1013
HASH_CMD=docker run -v $(CURDIR):/sum -w /sum debian:jessie bash hash_files
1114
DIR_TO_HASH:=build/linux
1215

@@ -16,8 +19,10 @@ export BUILDX_DIR
1619
export COMPOSE_DIR
1720
export SCAN_DIR
1821

19-
export STATIC_VERSION
22+
export CLI_VERSION
23+
export ENGINE_VERSION
2024
export CONTAINERD_VERSION
25+
export CONTAINERD_PKG_VER
2126
export RUNC_VERSION
2227

2328
.PHONY: help

static/build-static

Lines changed: 50 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ build_cli() {
3434
--build-arg PACKAGER_NAME \
3535
--build-arg PLATFORM \
3636
--build-arg PRODUCT \
37-
--build-arg VERSION="${STATIC_VERSION}" \
37+
--build-arg VERSION="${CLI_VERSION}" \
3838
--output ./build \
3939
--platform "${TARGETPLATFORM}" \
4040
--target binary .
@@ -54,7 +54,7 @@ build_engine() {
5454
--build-arg PLATFORM \
5555
--build-arg PRODUCT \
5656
--build-arg RUNC_VERSION \
57-
--build-arg VERSION="${STATIC_VERSION}" \
57+
--build-arg VERSION="${ENGINE_VERSION}" \
5858
--output ./bundles \
5959
--platform "${TARGETPLATFORM}" \
6060
--target binary .
@@ -78,7 +78,7 @@ build_engine_cross() {
7878
--build-arg PLATFORM \
7979
--build-arg PRODUCT \
8080
--build-arg RUNC_VERSION \
81-
--build-arg VERSION="${STATIC_VERSION}" \
81+
--build-arg VERSION="${ENGINE_VERSION}" \
8282
--output ./bundles \
8383
--target cross .
8484
mkdir -p "./bundles/${TARGETPLATFORM}"
@@ -141,7 +141,9 @@ fi
141141

142142
buildDir="${CURDIR}/build/${TARGETPLATFORM}"
143143

144-
dockerBuildDir="${buildDir}/docker"
144+
dockerCLIBuildDir="${buildDir}/docker-cli"
145+
dockerBuildDir="${buildDir}/docker-engine"
146+
containerdBuildDir="${buildDir}/containerd"
145147
rootlessExtrasBuildDir="${buildDir}/docker-rootless-extras"
146148
buildxBuildDir="${buildDir}/docker-buildx"
147149
composeBuildDir="${buildDir}/docker-compose"
@@ -186,42 +188,75 @@ esac
186188
# cleanup
187189
[ -d "${buildDir}" ] && rm -r "${buildDir}"
188190

189-
# docker
190-
mkdir -p "${dockerBuildDir}"
191+
# docker CLI
192+
mkdir -p "${dockerCLIBuildDir}"
191193
case ${TARGETOS} in
192194
linux | darwin)
193-
cp "${CLI_DIR}"/build/"${targetPair}"/docker-"${TARGETOS}"-* "${dockerBuildDir}/docker"
195+
cp "${CLI_DIR}"/build/"${targetPair}"/docker-"${TARGETOS}"-* "${dockerCLIBuildDir}/docker"
194196
;;
195197
windows)
196-
cp "${CLI_DIR}"/build/"${targetPair}"/docker-"${TARGETOS}"-*.exe "${dockerBuildDir}/docker.exe"
198+
cp "${CLI_DIR}"/build/"${targetPair}"/docker-"${TARGETOS}"-*.exe "${dockerCLIBuildDir}/docker.exe"
199+
;;
200+
esac
201+
# package docker CLI
202+
case ${TARGETOS} in
203+
linux | darwin)
204+
(
205+
set -x
206+
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-cli-${CLI_VERSION}.tgz" docker-cli
207+
)
208+
;;
209+
windows)
210+
(
211+
cd "${buildDir}"
212+
set -x
213+
zip -r "docker-cli-${CLI_VERSION}.zip" docker-cli
214+
)
197215
;;
198216
esac
217+
218+
# docker, containerd, and runc
219+
mkdir -p "${dockerBuildDir}"
199220
case ${TARGETOS} in
200221
linux)
201-
for f in dockerd containerd ctr containerd-shim containerd-shim-runc-v2 docker-init docker-proxy runc; do
222+
for f in dockerd docker-init docker-proxy; do
202223
if [ -f "${ENGINE_DIR}/bundles/${TARGETPLATFORM}/$f" ]; then
203224
cp -L "${ENGINE_DIR}/bundles/${TARGETPLATFORM}/$f" "${dockerBuildDir}/$f"
204225
fi
205226
done
227+
# TODO containerd binaries should be built as part of containerd-packaging, not as part of docker/docker-ce-packaging
228+
mkdir -p "${containerdBuildDir}"
229+
for f in containerd ctr containerd-shim containerd-shim-runc-v2 runc; do
230+
if [ -f "${ENGINE_DIR}/bundles/${TARGETPLATFORM}/$f" ]; then
231+
cp -L "${ENGINE_DIR}/bundles/${TARGETPLATFORM}/$f" "${containerdBuildDir}/$f"
232+
fi
233+
done
206234
;;
207235
windows)
208236
cp "${ENGINE_DIR}"/bundles/"${TARGETPLATFORM}"/dockerd.exe "${dockerBuildDir}/dockerd.exe"
209237
cp "${ENGINE_DIR}"/bundles/"${TARGETPLATFORM}"/docker-proxy.exe "${dockerBuildDir}/docker-proxy.exe"
210238
;;
211239
esac
212-
# package docker
240+
# package docker, containerd, and runc
213241
case ${TARGETOS} in
214-
linux | darwin)
242+
darwin)
243+
(
244+
set -x
245+
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-engine-${ENGINE_VERSION}.tgz" docker-engine
246+
)
247+
;;
248+
linux)
215249
(
216250
set -x
217-
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-${STATIC_VERSION}.tgz" docker
251+
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-engine-${ENGINE_VERSION}.tgz" docker-engine
252+
tar -C "${buildDir}" -c -z -f "${buildDir}/containerd-${CONTAINERD_PKG_VER#v}.tgz" containerd
218253
)
219254
;;
220255
windows)
221256
(
222257
cd "${buildDir}"
223258
set -x
224-
zip -r "docker-${STATIC_VERSION}.zip" docker
259+
zip -r "docker-engine-${ENGINE_VERSION}.zip" docker-engine
225260
)
226261
;;
227262
esac
@@ -243,7 +278,7 @@ if [ -d "${rootlessExtrasBuildDir}" ]; then
243278
linux)
244279
(
245280
set -x
246-
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-rootless-extras-${STATIC_VERSION}.tgz" docker-rootless-extras
281+
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-rootless-extras-${ENGINE_VERSION}.tgz" docker-rootless-extras
247282
)
248283
;;
249284
esac
@@ -356,5 +391,6 @@ fi
356391
set -x
357392
cd "${buildDir}"
358393
rm -r */
394+
# bundle is expected to have a tar.gz extension, unlike the other archives, which use .tgz
359395
tar -zvcf "${CURDIR}/build/bundles-ce-static-${TARGETOS}-${BUNDLEARCH}.tar.gz" .
360396
)

static/gen-containerd-ver

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
engine_dir="$1"
4+
# containerd_pkg_version is used to name the containerd-<version>.tgz file.
5+
containerd_pkg_version="$2"
6+
7+
if [ -z "${containerd_pkg_version}" ]; then
8+
# If no custom version is set for containerd, we select the default version of
9+
# containerd based on the docker engine source.
10+
# which is needed for naming the produced .tgz file.
11+
# TODO containerd binaries should be built as part of containerd-packaging, not as part of docker/docker-ce-packaging
12+
awk -F'=' '$1 == "ARG CONTAINERD_VERSION" {{sub("v","")}; print $2 }' "${engine_dir}/Dockerfile.windows"
13+
else
14+
echo "${containerd_pkg_version#v}"
15+
fi

0 commit comments

Comments
 (0)