Skip to content

Commit de2dd7a

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 cc73008 commit de2dd7a

File tree

1 file changed

+56
-10
lines changed

1 file changed

+56
-10
lines changed

static/build-static

Lines changed: 56 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ fi
2222

2323
source "../scripts/target-platform"
2424

25+
if [ -z "$CONTAINERD_VERSION" ]; then
26+
# Select the default version of containerd based on the docker engine source,
27+
# which is needed for naming the produced .tgz file. We normalize the value to
28+
# always have a "v" prefix.
29+
# TODO containerd binaries should be built as part of containerd-packaging, not as part of docker/docker-ce-packaging
30+
CONTAINERD_VERSION="$(awk -F'=' '$1 == "ARG CONTAINERD_VERSION" {{sub("v","")}; print "v" $2 }' "${ENGINE_DIR}/Dockerfile.windows")"
31+
export CONTAINERD_VERSION
32+
fi
33+
2534
build_cli() {
2635
[ -d "${CLI_DIR:?}/build" ] && rm -r "${CLI_DIR:?}/build"
2736
(
@@ -130,6 +139,7 @@ echo "UNAME=$(uname -m)"
130139
echo "TARGETPLATFORM=${TARGETPLATFORM}"
131140
echo "CURPLATFORM=${CURPLATFORM}"
132141
echo "CROSS=${CROSS}"
142+
echo "CONTAINERD_VERSION=${CONTAINERD_VERSION}"
133143

134144
cgo_enabled=""
135145
if [ "$TARGETARCH" = "arm" ] && [ -n "$TARGETVARIANT" ]; then
@@ -143,7 +153,9 @@ fi
143153

144154
buildDir="${CURDIR}/build/${TARGETPLATFORM}"
145155

146-
dockerBuildDir="${buildDir}/docker"
156+
dockerCLIBuildDir="${buildDir}/docker-cli"
157+
dockerBuildDir="${buildDir}/docker-engine"
158+
containerdBuildDir="${buildDir}/containerd"
147159
rootlessExtrasBuildDir="${buildDir}/docker-rootless-extras"
148160
buildxBuildDir="${buildDir}/docker-buildx"
149161
composeBuildDir="${buildDir}/docker-compose"
@@ -188,42 +200,75 @@ esac
188200
# cleanup
189201
[ -d "${buildDir}" ] && rm -r "${buildDir}"
190202

191-
# docker
192-
mkdir -p "${dockerBuildDir}"
203+
# docker CLI
204+
mkdir -p "${dockerCLIBuildDir}"
205+
case ${TARGETOS} in
206+
linux | darwin)
207+
cp "${CLI_DIR}"/build/"${targetPair}"/docker-"${TARGETOS}"-* "${dockerCLIBuildDir}/docker"
208+
;;
209+
windows)
210+
cp "${CLI_DIR}"/build/"${targetPair}"/docker-"${TARGETOS}"-*.exe "${dockerCLIBuildDir}/docker.exe"
211+
;;
212+
esac
213+
# package docker CLI
193214
case ${TARGETOS} in
194215
linux | darwin)
195-
cp "${CLI_DIR}"/build/"${targetPair}"/docker-"${TARGETOS}"-* "${dockerBuildDir}/docker"
216+
(
217+
set -x
218+
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-cli-${STATIC_VERSION}.tgz" docker-cli
219+
)
196220
;;
197221
windows)
198-
cp "${CLI_DIR}"/build/"${targetPair}"/docker-"${TARGETOS}"-*.exe "${dockerBuildDir}/docker.exe"
222+
(
223+
cd "${buildDir}"
224+
set -x
225+
zip -r "docker-cli-${STATIC_VERSION}.zip" docker-cli
226+
)
199227
;;
200228
esac
229+
230+
# docker, containerd, and runc
231+
mkdir -p "${dockerBuildDir}"
201232
case ${TARGETOS} in
202233
linux)
203-
for f in dockerd containerd ctr containerd-shim containerd-shim-runc-v2 docker-init docker-proxy runc; do
234+
for f in dockerd docker-init docker-proxy; do
204235
if [ -f "${ENGINE_DIR}/bundles/${TARGETPLATFORM}/$f" ]; then
205236
cp -L "${ENGINE_DIR}/bundles/${TARGETPLATFORM}/$f" "${dockerBuildDir}/$f"
206237
fi
207238
done
239+
# TODO containerd binaries should be built as part of containerd-packaging, not as part of docker/docker-ce-packaging
240+
mkdir -p "${containerdBuildDir}"
241+
for f in containerd ctr containerd-shim containerd-shim-runc-v2 runc; do
242+
if [ -f "${ENGINE_DIR}/bundles/${TARGETPLATFORM}/$f" ]; then
243+
cp -L "${ENGINE_DIR}/bundles/${TARGETPLATFORM}/$f" "${containerdBuildDir}/$f"
244+
fi
245+
done
208246
;;
209247
windows)
210248
cp "${ENGINE_DIR}"/bundles/"${TARGETPLATFORM}"/dockerd-*.exe "${dockerBuildDir}/dockerd.exe"
211249
cp "${ENGINE_DIR}"/bundles/"${TARGETPLATFORM}"/docker-proxy-*.exe "${dockerBuildDir}/docker-proxy.exe"
212250
;;
213251
esac
214-
# package docker
252+
# package docker, containerd, and runc
215253
case ${TARGETOS} in
216-
linux | darwin)
254+
darwin)
255+
(
256+
set -x
257+
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-engine-${STATIC_VERSION}.tgz" docker-engine
258+
)
259+
;;
260+
linux)
217261
(
218262
set -x
219-
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-${STATIC_VERSION}.tgz" docker
263+
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-engine-${STATIC_VERSION}.tgz" docker-engine
264+
tar -C "${buildDir}" -c -z -f "${buildDir}/containerd-${CONTAINERD_VERSION#v}.tgz" containerd
220265
)
221266
;;
222267
windows)
223268
(
224269
cd "${buildDir}"
225270
set -x
226-
zip -r "docker-${STATIC_VERSION}.zip" docker
271+
zip -r "docker-engine-${STATIC_VERSION}.zip" docker-engine
227272
)
228273
;;
229274
esac
@@ -358,5 +403,6 @@ fi
358403
set -x
359404
cd "${buildDir}"
360405
rm -r */
406+
# bundle is expected to have a tar.gz extension, unlike the other archives, which use .tgz
361407
tar -zvcf "${CURDIR}/build/bundles-ce-static-${TARGETOS}-${BUNDLEARCH}.tar.gz" .
362408
)

0 commit comments

Comments
 (0)