Skip to content

Commit d982a96

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 d982a96

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
(
@@ -128,6 +137,7 @@ echo "UNAME=$(uname -m)"
128137
echo "TARGETPLATFORM=${TARGETPLATFORM}"
129138
echo "CURPLATFORM=${CURPLATFORM}"
130139
echo "CROSS=${CROSS}"
140+
echo "CONTAINERD_VERSION=${CONTAINERD_VERSION}"
131141

132142
cgo_enabled=""
133143
if [ "$TARGETARCH" = "arm" ] && [ -n "$TARGETVARIANT" ]; then
@@ -141,7 +151,9 @@ fi
141151

142152
buildDir="${CURDIR}/build/${TARGETPLATFORM}"
143153

144-
dockerBuildDir="${buildDir}/docker"
154+
dockerCLIBuildDir="${buildDir}/docker-cli"
155+
dockerBuildDir="${buildDir}/docker-engine"
156+
containerdBuildDir="${buildDir}/containerd"
145157
rootlessExtrasBuildDir="${buildDir}/docker-rootless-extras"
146158
buildxBuildDir="${buildDir}/docker-buildx"
147159
composeBuildDir="${buildDir}/docker-compose"
@@ -186,42 +198,75 @@ esac
186198
# cleanup
187199
[ -d "${buildDir}" ] && rm -r "${buildDir}"
188200

189-
# docker
190-
mkdir -p "${dockerBuildDir}"
201+
# docker CLI
202+
mkdir -p "${dockerCLIBuildDir}"
203+
case ${TARGETOS} in
204+
linux | darwin)
205+
cp "${CLI_DIR}"/build/"${targetPair}"/docker-"${TARGETOS}"-* "${dockerCLIBuildDir}/docker"
206+
;;
207+
windows)
208+
cp "${CLI_DIR}"/build/"${targetPair}"/docker-"${TARGETOS}"-*.exe "${dockerCLIBuildDir}/docker.exe"
209+
;;
210+
esac
211+
# package docker CLI
191212
case ${TARGETOS} in
192213
linux | darwin)
193-
cp "${CLI_DIR}"/build/"${targetPair}"/docker-"${TARGETOS}"-* "${dockerBuildDir}/docker"
214+
(
215+
set -x
216+
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-cli-${STATIC_VERSION}.tgz" docker-cli
217+
)
194218
;;
195219
windows)
196-
cp "${CLI_DIR}"/build/"${targetPair}"/docker-"${TARGETOS}"-*.exe "${dockerBuildDir}/docker.exe"
220+
(
221+
cd "${buildDir}"
222+
set -x
223+
zip -r "docker-cli-${STATIC_VERSION}.zip" docker-cli
224+
)
197225
;;
198226
esac
227+
228+
# docker, containerd, and runc
229+
mkdir -p "${dockerBuildDir}"
199230
case ${TARGETOS} in
200231
linux)
201-
for f in dockerd containerd ctr containerd-shim containerd-shim-runc-v2 docker-init docker-proxy runc; do
232+
for f in dockerd docker-init docker-proxy; do
202233
if [ -f "${ENGINE_DIR}/bundles/${TARGETPLATFORM}/$f" ]; then
203234
cp -L "${ENGINE_DIR}/bundles/${TARGETPLATFORM}/$f" "${dockerBuildDir}/$f"
204235
fi
205236
done
237+
# TODO containerd binaries should be built as part of containerd-packaging, not as part of docker/docker-ce-packaging
238+
mkdir -p "${containerdBuildDir}"
239+
for f in containerd ctr containerd-shim containerd-shim-runc-v2 runc; do
240+
if [ -f "${ENGINE_DIR}/bundles/${TARGETPLATFORM}/$f" ]; then
241+
cp -L "${ENGINE_DIR}/bundles/${TARGETPLATFORM}/$f" "${containerdBuildDir}/$f"
242+
fi
243+
done
206244
;;
207245
windows)
208246
cp "${ENGINE_DIR}"/bundles/"${TARGETPLATFORM}"/dockerd.exe "${dockerBuildDir}/dockerd.exe"
209247
cp "${ENGINE_DIR}"/bundles/"${TARGETPLATFORM}"/docker-proxy.exe "${dockerBuildDir}/docker-proxy.exe"
210248
;;
211249
esac
212-
# package docker
250+
# package docker, containerd, and runc
213251
case ${TARGETOS} in
214-
linux | darwin)
252+
darwin)
253+
(
254+
set -x
255+
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-engine-${STATIC_VERSION}.tgz" docker-engine
256+
)
257+
;;
258+
linux)
215259
(
216260
set -x
217-
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-${STATIC_VERSION}.tgz" docker
261+
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-engine-${STATIC_VERSION}.tgz" docker-engine
262+
tar -C "${buildDir}" -c -z -f "${buildDir}/containerd-${CONTAINERD_VERSION#v}.tgz" containerd
218263
)
219264
;;
220265
windows)
221266
(
222267
cd "${buildDir}"
223268
set -x
224-
zip -r "docker-${STATIC_VERSION}.zip" docker
269+
zip -r "docker-engine-${STATIC_VERSION}.zip" docker-engine
225270
)
226271
;;
227272
esac
@@ -356,5 +401,6 @@ fi
356401
set -x
357402
cd "${buildDir}"
358403
rm -r */
404+
# bundle is expected to have a tar.gz extension, unlike the other archives, which use .tgz
359405
tar -zvcf "${CURDIR}/build/bundles-ce-static-${TARGETOS}-${BUNDLEARCH}.tar.gz" .
360406
)

0 commit comments

Comments
 (0)