Created
January 26, 2018 09:45
-
-
Save shawn111/a39d651e85bc538dcad44c717b6ac8a2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
set -x | |
RUNC_BUILDTAGS="${RUNC_BUILDTAGS:-"seccomp selinux"}" | |
PROXY_LDFLAGS="-linkmode=external" | |
TARGET_PATH=${TARGET_PATH:-"/usr/local/bin"} | |
DOCKER_CE_PATH=$GOPATH/src/github.com/docker/docker | |
RUNC_PATH=$GOPATH/src/github.com/opencontainers/runc | |
CONTAINERD_PATH=$GOPATH/src/github.com/docker/containerd | |
TINI_PATH=$GOPATH/tini | |
PROXY_PATH=$GOPATH/src/proxy | |
fetch() { | |
mkdir -p `dirname $2` | |
rm -rf $2 | |
ln -s $RPM_BUILD_DIR/$1 $2 | |
} | |
build_runc() { | |
make BUILDTAGS="$RUNC_BUILDTAGS" $1 | |
} | |
install_runc() { | |
cp runc ${TARGET_PATH}/docker-runc | |
} | |
build_containerd() { | |
make $1 | |
} | |
install_containerd() { | |
cp bin/containerd ${TARGET_PATH}/docker-containerd | |
cp bin/containerd-shim ${TARGET_PATH}/docker-containerd-shim | |
cp bin/ctr ${TARGET_PATH}/docker-containerd-ctr | |
} | |
build_tini() { | |
cmake . | |
make tini-static | |
} | |
install_tini() { | |
cp tini-static ${TARGET_PATH}/docker-init | |
} | |
build_proxy() { | |
go build -ldflags="$PROXY_LDFLAGS" | |
} | |
install_proxy() { | |
cp proxy ${TARGET_PATH}/docker-proxy | |
} | |
mkdir -p ${TARGET_PATH} | |
for prog in "$@" | |
do | |
case $prog in | |
docker) | |
fetch "docker-ce" $DOCKER_CE_PATH | |
;; | |
runc) | |
fetch runc $RUNC_PATH | |
cd $RUNC_PATH | |
build_runc | |
install_runc | |
;; | |
containerd) | |
fetch containerd $CONTAINERD_PATH | |
cd $CONTAINERD_PATH | |
build_containerd | |
install_containerd | |
;; | |
tini) | |
fetch tini $TINI_PATH | |
cd $TINI_PATH | |
build_tini | |
install_tini | |
;; | |
proxy) | |
fetch proxy $PROXY_PATH | |
cd $PROXY_PATH | |
build_proxy | |
install_proxy | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment