github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/hack/dockerfile/install/dockercli.installer (about)

     1  #!/bin/sh
     2  
     3  : ${DOCKERCLI_CHANNEL:=stable}
     4  : ${DOCKERCLI_VERSION:=17.06.2-ce}
     5  
     6  install_dockercli() {
     7  	echo "Install docker/cli version $DOCKERCLI_VERSION from $DOCKERCLI_CHANNEL"
     8  
     9  	arch=$(uname -m)
    10  	# No official release of these platforms
    11  	if [ "$arch" != "x86_64" ] && [ "$arch" != "s390x" ] && [ "$arch" != "armhf" ]; then
    12  		build_dockercli
    13  		return
    14  	fi
    15  
    16  	url=https://download.docker.com/linux/static
    17  	curl -Ls "${url}/${DOCKERCLI_CHANNEL}/${arch}/docker-${DOCKERCLI_VERSION}.tgz" | tar -xz docker/docker
    18  	mkdir -p "${PREFIX}"
    19  	mv docker/docker "${PREFIX}/"
    20  	rmdir docker
    21  }
    22  
    23  build_dockercli() {
    24  	git clone https://github.com/demonoid81/moby-ce "$GOPATH/tmp/docker-ce"
    25  	cd "$GOPATH/tmp/docker-ce"
    26  	git checkout -q "v$DOCKERCLI_VERSION"
    27  	mkdir -p "$GOPATH/src/github.com/docker"
    28  	mv components/cli "$GOPATH/src/github.com/docker/cli"
    29  	go build -buildmode=pie -o "${PREFIX}/docker" "github.com/docker/cli/cmd/docker"
    30  }