mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
0c350e87a0
reference:
https://github.com/docker/cli/pull/2507
4c99c81326
Signed-off-by: Xiaodong Liu <liuxiaodong@loongson.cn>
30 lines
917 B
Bash
Executable file
30 lines
917 B
Bash
Executable file
#!/bin/sh
|
|
|
|
: ${DOCKERCLI_CHANNEL:=stable}
|
|
: ${DOCKERCLI_VERSION:=17.06.2-ce}
|
|
|
|
install_dockercli() {
|
|
echo "Install docker/cli version $DOCKERCLI_VERSION from $DOCKERCLI_CHANNEL"
|
|
|
|
arch=$(uname -m)
|
|
# No official release of these platforms
|
|
if [ "$arch" != "x86_64" ] && [ "$arch" != "s390x" ] && [ "$arch" != "armhf" ]; then
|
|
build_dockercli
|
|
return
|
|
fi
|
|
|
|
url=https://download.docker.com/linux/static
|
|
curl -Ls "${url}/${DOCKERCLI_CHANNEL}/${arch}/docker-${DOCKERCLI_VERSION}.tgz" | tar -xz docker/docker
|
|
mkdir -p "${PREFIX}"
|
|
mv docker/docker "${PREFIX}/"
|
|
rmdir docker
|
|
}
|
|
|
|
build_dockercli() {
|
|
git clone https://github.com/docker/docker-ce "$GOPATH/tmp/docker-ce"
|
|
cd "$GOPATH/tmp/docker-ce"
|
|
git checkout -q "v$DOCKERCLI_VERSION"
|
|
mkdir -p "$GOPATH/src/github.com/docker"
|
|
mv components/cli "$GOPATH/src/github.com/docker/cli"
|
|
go build ${GO_BUILDMODE} -o "${PREFIX}/docker" "github.com/docker/cli/cmd/docker"
|
|
}
|