2017-10-15 17:24:40 +00:00
|
|
|
#!/usr/bin/env bash
|
2022-06-03 01:50:37 +00:00
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
if [[ $# -ne 3 ]]; then
|
|
|
|
echo "Illegal number of parameters" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
2017-10-15 17:24:40 +00:00
|
|
|
|
|
|
|
PLATFORM=$1
|
|
|
|
ARCH=$2
|
2022-06-03 01:50:37 +00:00
|
|
|
DOCKER_VERSION=${3:1}
|
2017-10-15 17:24:40 +00:00
|
|
|
DOWNLOAD_FOLDER=".tmp/download"
|
|
|
|
|
2022-06-21 22:06:46 +00:00
|
|
|
if [[ ${PLATFORM} == "darwin" ]]; then
|
|
|
|
PLATFORM="mac"
|
|
|
|
fi
|
2022-06-03 01:50:37 +00:00
|
|
|
|
|
|
|
if [[ ${ARCH} == "amd64" ]]; then
|
|
|
|
ARCH="x86_64"
|
|
|
|
elif [[ ${ARCH} == "arm" ]]; then
|
|
|
|
ARCH="armhf"
|
|
|
|
elif [[ ${ARCH} == "arm64" ]]; then
|
|
|
|
ARCH="aarch64"
|
2022-06-26 21:48:49 +00:00
|
|
|
elif [[ ${ARCH} == "ppc64le" ]]; then
|
2022-06-27 23:40:18 +00:00
|
|
|
DOCKER_VERSION="18.06.3-ce"
|
2022-06-26 21:48:49 +00:00
|
|
|
elif [[ ${ARCH} == "s390x" ]]; then
|
2022-06-27 23:40:18 +00:00
|
|
|
DOCKER_VERSION="18.06.3-ce"
|
2022-06-03 01:50:37 +00:00
|
|
|
fi
|
|
|
|
|
2017-10-15 17:24:40 +00:00
|
|
|
rm -rf "${DOWNLOAD_FOLDER}"
|
|
|
|
mkdir -pv "${DOWNLOAD_FOLDER}"
|
|
|
|
|
2022-06-03 01:50:37 +00:00
|
|
|
if [[ ${PLATFORM} == "windows" ]]; then
|
|
|
|
wget -O "${DOWNLOAD_FOLDER}/docker-binaries.zip" "https://download.docker.com/win/static/stable/${ARCH}/docker-${DOCKER_VERSION}.zip"
|
|
|
|
unzip "${DOWNLOAD_FOLDER}/docker-binaries.zip" -d "${DOWNLOAD_FOLDER}"
|
|
|
|
mv "${DOWNLOAD_FOLDER}/docker/docker.exe" dist/
|
2017-10-15 17:24:40 +00:00
|
|
|
else
|
2022-06-03 01:50:37 +00:00
|
|
|
wget -O "${DOWNLOAD_FOLDER}/docker-binaries.tgz" "https://download.docker.com/${PLATFORM}/static/stable/${ARCH}/docker-${DOCKER_VERSION}.tgz"
|
|
|
|
tar -xf "${DOWNLOAD_FOLDER}/docker-binaries.tgz" -C "${DOWNLOAD_FOLDER}"
|
|
|
|
mv "${DOWNLOAD_FOLDER}/docker/docker" dist/
|
2017-10-15 17:24:40 +00:00
|
|
|
fi
|