Skip to content

Commit af71d24

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 ca8a37c commit af71d24

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
@@ -14,6 +14,15 @@ fi
1414

1515
source "../scripts/target-platform"
1616

17+
if [ -z "$CONTAINERD_VERSION" ]; then
18+
# Select the default version of containerd based on the docker engine source,
19+
# which is needed for naming the produced .tgz file. We normalize the value to
20+
# always have a "v" prefix.
21+
# TODO containerd binaries should be built as part of containerd-packaging, not as part of docker/docker-ce-packaging
22+
CONTAINERD_VERSION="$(awk -F'=' '$1 == "ARG CONTAINERD_VERSION" {{sub("v","")}; print "v" $2 }' "${ENGINE_DIR}/Dockerfile.windows")"
23+
export CONTAINERD_VERSION
24+
fi
25+
1726
build_cli() {
1827
[ -d "${CLI_DIR:?}/build" ] && rm -r "${CLI_DIR:?}/build"
1928
(
@@ -122,6 +131,7 @@ echo "UNAME=$(uname -m)"
122131
echo "TARGETPLATFORM=${TARGETPLATFORM}"
123132
echo "CURPLATFORM=${CURPLATFORM}"
124133
echo "CROSS=${CROSS}"
134+
echo "CONTAINERD_VERSION=${CONTAINERD_VERSION}"
125135

126136
cgo_enabled=""
127137
if [ "$TARGETARCH" = "arm" ] && [ -n "$TARGETVARIANT" ]; then
@@ -135,7 +145,9 @@ fi
135145

136146
buildDir="${CURDIR}/build/${TARGETPLATFORM}"
137147

138-
dockerBuildDir="${buildDir}/docker"
148+
dockerCLIBuildDir="${buildDir}/docker-cli"
149+
dockerBuildDir="${buildDir}/docker-engine"
150+
containerdBuildDir="${buildDir}/containerd"
139151
rootlessExtrasBuildDir="${buildDir}/docker-rootless-extras"
140152
buildxBuildDir="${buildDir}/docker-buildx"
141153
composeBuildDir="${buildDir}/docker-compose"
@@ -180,42 +192,75 @@ esac
180192
# cleanup
181193
[ -d "${buildDir}" ] && rm -r "${buildDir}"
182194

183-
# docker
184-
mkdir -p "${dockerBuildDir}"
195+
# docker CLI
196+
mkdir -p "${dockerCLIBuildDir}"
197+
case ${TARGETOS} in
198+
linux | darwin)
199+
cp "${CLI_DIR}"/build/"${targetPair}"/docker-"${TARGETOS}"-* "${dockerCLIBuildDir}/docker"
200+
;;
201+
windows)
202+
cp "${CLI_DIR}"/build/"${targetPair}"/docker-"${TARGETOS}"-*.exe "${dockerCLIBuildDir}/docker.exe"
203+
;;
204+
esac
205+
# package docker CLI
185206
case ${TARGETOS} in
186207
linux | darwin)
187-
cp "${CLI_DIR}"/build/"${targetPair}"/docker-"${TARGETOS}"-* "${dockerBuildDir}/docker"
208+
(
209+
set -x
210+
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-cli-${STATIC_VERSION}.tgz" docker-cli
211+
)
188212
;;
189213
windows)
190-
cp "${CLI_DIR}"/build/"${targetPair}"/docker-"${TARGETOS}"-*.exe "${dockerBuildDir}/docker.exe"
214+
(
215+
cd "${buildDir}"
216+
set -x
217+
zip -r "docker-cli-${STATIC_VERSION}.zip" docker-cli
218+
)
191219
;;
192220
esac
221+
222+
# docker, containerd, and runc
223+
mkdir -p "${dockerBuildDir}"
193224
case ${TARGETOS} in
194225
linux)
195-
for f in dockerd containerd ctr containerd-shim containerd-shim-runc-v2 docker-init docker-proxy runc; do
226+
for f in dockerd docker-init docker-proxy; do
196227
if [ -f "${ENGINE_DIR}/bundles/${TARGETPLATFORM}/$f" ]; then
197228
cp -L "${ENGINE_DIR}/bundles/${TARGETPLATFORM}/$f" "${dockerBuildDir}/$f"
198229
fi
199230
done
231+
# TODO containerd binaries should be built as part of containerd-packaging, not as part of docker/docker-ce-packaging
232+
mkdir -p "${containerdBuildDir}"
233+
for f in containerd ctr containerd-shim containerd-shim-runc-v2 runc; do
234+
if [ -f "${ENGINE_DIR}/bundles/${TARGETPLATFORM}/$f" ]; then
235+
cp -L "${ENGINE_DIR}/bundles/${TARGETPLATFORM}/$f" "${containerdBuildDir}/$f"
236+
fi
237+
done
200238
;;
201239
windows)
202240
cp "${ENGINE_DIR}"/bundles/"${TARGETPLATFORM}"/dockerd-*.exe "${dockerBuildDir}/dockerd.exe"
203241
cp "${ENGINE_DIR}"/bundles/"${TARGETPLATFORM}"/docker-proxy-*.exe "${dockerBuildDir}/docker-proxy.exe"
204242
;;
205243
esac
206-
# package docker
244+
# package docker, containerd, and runc
207245
case ${TARGETOS} in
208-
linux | darwin)
246+
darwin)
247+
(
248+
set -x
249+
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-engine-${STATIC_VERSION}.tgz" docker-engine
250+
)
251+
;;
252+
linux)
209253
(
210254
set -x
211-
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-${STATIC_VERSION}.tgz" docker
255+
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-engine-${STATIC_VERSION}.tgz" docker-engine
256+
tar -C "${buildDir}" -c -z -f "${buildDir}/containerd-${CONTAINERD_VERSION#v}.tgz" containerd
212257
)
213258
;;
214259
windows)
215260
(
216261
cd "${buildDir}"
217262
set -x
218-
zip -r "docker-${STATIC_VERSION}.zip" docker
263+
zip -r "docker-engine-${STATIC_VERSION}.zip" docker-engine
219264
)
220265
;;
221266
esac
@@ -350,5 +395,6 @@ fi
350395
set -x
351396
cd "${buildDir}"
352397
rm -r */
398+
# bundle is expected to have a tar.gz extension, unlike the other archives, which use .tgz
353399
tar -zvcf "${CURDIR}/build/bundles-ce-static-${TARGETOS}-${BUNDLEARCH}.tar.gz" .
354400
)

0 commit comments

Comments
 (0)