Skip to content

Commit 6d4153d

Browse files
thaJeztahcrazy-max
authored andcommitted
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 102bbae commit 6d4153d

File tree

2 files changed

+53
-10
lines changed

2 files changed

+53
-10
lines changed

static/Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ export COMPOSE_DIR
1717
export SCAN_DIR
1818

1919
export STATIC_VERSION
20+
21+
# Select the default version of containerd based on the docker engine source
22+
# we need this variable here for naming the produced .tgz file.
23+
# TODO containerd binaries should be built as part of containerd-packaging, not as part of docker/docker-ce-packaging
24+
CONTAINERD_VERSION?=v$(shell grep "ARG CONTAINERD_VERSION" "$(ENGINE_DIR)/Dockerfile.windows" | awk -F'=' '{print $$2}')
25+
2026
export CONTAINERD_VERSION
2127
export RUNC_VERSION
2228

static/build-static

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ echo "UNAME=$(uname -m)"
122122
echo "TARGETPLATFORM=${TARGETPLATFORM}"
123123
echo "CURPLATFORM=${CURPLATFORM}"
124124
echo "CROSS=${CROSS}"
125+
echo "CONTAINERD_VERSION=${CONTAINERD_VERSION}"
125126

126127
cgo_enabled=""
127128
if [ "$TARGETARCH" = "arm" ] && [ -n "$TARGETVARIANT" ]; then
@@ -135,7 +136,9 @@ fi
135136

136137
buildDir="${CURDIR}/build/${TARGETPLATFORM}"
137138

138-
dockerBuildDir="${buildDir}/docker"
139+
dockerCLIBuildDir="${buildDir}/docker-cli"
140+
dockerBuildDir="${buildDir}/docker-engine"
141+
containerdBuildDir="${buildDir}/containerd"
139142
rootlessExtrasBuildDir="${buildDir}/docker-rootless-extras"
140143
buildxBuildDir="${buildDir}/docker-buildx"
141144
composeBuildDir="${buildDir}/docker-compose"
@@ -180,42 +183,75 @@ esac
180183
# cleanup
181184
[ -d "${buildDir}" ] && rm -r "${buildDir}"
182185

183-
# docker
184-
mkdir -p "${dockerBuildDir}"
186+
# docker CLI
187+
mkdir -p "${dockerCLIBuildDir}"
185188
case ${TARGETOS} in
186189
linux | darwin)
187-
cp "${CLI_DIR}"/build/"${targetPair}"/docker-"${TARGETOS}"-* "${dockerBuildDir}/docker"
190+
cp "${CLI_DIR}"/build/"${targetPair}"/docker-"${TARGETOS}"-* "${dockerCLIBuildDir}/docker"
188191
;;
189192
windows)
190-
cp "${CLI_DIR}"/build/"${targetPair}"/docker-"${TARGETOS}"-*.exe "${dockerBuildDir}/docker.exe"
193+
cp "${CLI_DIR}"/build/"${targetPair}"/docker-"${TARGETOS}"-*.exe "${dockerCLIBuildDir}/docker.exe"
194+
;;
195+
esac
196+
# package docker CLI
197+
case ${TARGETOS} in
198+
linux | darwin)
199+
(
200+
set -x
201+
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-cli-${STATIC_VERSION}.tgz" docker-cli
202+
)
203+
;;
204+
windows)
205+
(
206+
cd "${buildDir}"
207+
set -x
208+
zip -r "docker-cli-${STATIC_VERSION}.zip" docker-cli
209+
)
191210
;;
192211
esac
212+
213+
# docker, containerd, and runc
214+
mkdir -p "${dockerBuildDir}"
193215
case ${TARGETOS} in
194216
linux)
195-
for f in dockerd containerd ctr containerd-shim containerd-shim-runc-v2 docker-init docker-proxy runc; do
217+
for f in dockerd docker-init docker-proxy; do
196218
if [ -f "${ENGINE_DIR}/bundles/${TARGETPLATFORM}/$f" ]; then
197219
cp -L "${ENGINE_DIR}/bundles/${TARGETPLATFORM}/$f" "${dockerBuildDir}/$f"
198220
fi
199221
done
222+
# TODO containerd binaries should be built as part of containerd-packaging, not as part of docker/docker-ce-packaging
223+
mkdir -p "${containerdBuildDir}"
224+
for f in containerd ctr containerd-shim containerd-shim-runc-v2 runc; do
225+
if [ -f "${ENGINE_DIR}/bundles/${TARGETPLATFORM}/$f" ]; then
226+
cp -L "${ENGINE_DIR}/bundles/${TARGETPLATFORM}/$f" "${containerdBuildDir}/$f"
227+
fi
228+
done
200229
;;
201230
windows)
202231
cp "${ENGINE_DIR}"/bundles/"${TARGETPLATFORM}"/dockerd-*.exe "${dockerBuildDir}/dockerd.exe"
203232
cp "${ENGINE_DIR}"/bundles/"${TARGETPLATFORM}"/docker-proxy-*.exe "${dockerBuildDir}/docker-proxy.exe"
204233
;;
205234
esac
206-
# package docker
235+
# package docker, containerd, and runc
207236
case ${TARGETOS} in
208-
linux | darwin)
237+
darwin)
238+
(
239+
set -x
240+
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-engine-${STATIC_VERSION}.tgz" docker-engine
241+
)
242+
;;
243+
linux)
209244
(
210245
set -x
211-
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-${STATIC_VERSION}.tgz" docker
246+
tar -C "${buildDir}" -c -z -f "${buildDir}/docker-engine-${STATIC_VERSION}.tgz" docker-engine
247+
tar -C "${buildDir}" -c -z -f "${buildDir}/containerd-${CONTAINERD_VERSION#v}.tgz" containerd
212248
)
213249
;;
214250
windows)
215251
(
216252
cd "${buildDir}"
217253
set -x
218-
zip -r "docker-${STATIC_VERSION}.zip" docker
254+
zip -r "docker-engine-${STATIC_VERSION}.zip" docker-engine
219255
)
220256
;;
221257
esac
@@ -350,5 +386,6 @@ fi
350386
set -x
351387
cd "${buildDir}"
352388
rm -r */
389+
# bundle is expected to have a tar.gz extension, unlike the other archives, which use .tgz
353390
tar -zvcf "${CURDIR}/build/bundles-ce-static-${TARGETOS}-${BUNDLEARCH}.tar.gz" .
354391
)

0 commit comments

Comments
 (0)