Add make install task

This installs docker and dockerd to `$DOCKER_MAKE_INSTALL_PREFIX/bin`, which
defaults to `/usr/local/bin`

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Brian Goff 2016-05-23 21:44:43 -04:00 committed by Sebastiaan van Stijn
parent a11d40af9b
commit 9bb54f89ad
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
11 changed files with 79 additions and 14 deletions

View file

@ -91,6 +91,9 @@ docs: ## build the docs
gccgo: build-gccgo ## build the gcc-go linux binaries
$(DOCKER_FLAGS) "$(DOCKER_IMAGE)-gccgo" hack/make.sh gccgo
install: ## install the linux binaries
KEEPBUNDLE=1 hack/make.sh install-binary
rpm: build ## build the rpm packages
$(DOCKER_RUN_DOCKER) hack/make.sh dynbinary build-rpm

View file

@ -333,6 +333,19 @@ copy_containerd() {
fi
}
install_binary() {
file="$1"
target="${DOCKER_MAKE_INSTALL_PREFIX:=/usr/local}/bin/"
if [ "$(go env GOOS)" == "linux" ]; then
echo "Installing $(basename $file) to ${target}"
cp -L "$file" "$target"
else
echo "Install is only supported on linux"
return 1
fi
}
main() {
# We want this to fail if the bundles already exist and cannot be removed.
# This is to avoid mixing bundles from different versions of the code.

4
hack/make/.binary-setup Normal file
View file

@ -0,0 +1,4 @@
#!/bin/bash
DOCKER_CLIENT_BINARY_NAME='docker'
DOCKER_DAEMON_BINARY_NAME='dockerd'

View file

@ -1,5 +1,6 @@
#!/bin/bash
set -e
rm -rf "$DEST"
# This script exists as backwards compatibility for CI
(

View file

@ -1,8 +1,12 @@
#!/bin/bash
set -e
[ -z "$KEEPDEST" ] && \
rm -rf "$DEST"
(
export BINARY_SHORT_NAME='docker'
source "${MAKEDIR}/.binary-setup"
export BINARY_SHORT_NAME="$DOCKER_CLIENT_BINARY_NAME"
export SOURCE_PATH='./cmd/docker'
source "${MAKEDIR}/.binary"
)

View file

@ -1,9 +1,13 @@
#!/bin/bash
set -e
[ -z "$KEEPDEST" ] && \
rm -rf "$DEST"
(
export BINARY_SHORT_NAME='dockerd'
source "${MAKEDIR}/.binary-setup"
export BINARY_SHORT_NAME="$DOCKER_DAEMON_BINARY_NAME"
export SOURCE_PATH='./cmd/dockerd'
source "${MAKEDIR}/.binary"
copy_containerd "$DEST" 'hash'
)
)

View file

@ -21,6 +21,7 @@ fi
for platform in $DOCKER_CROSSPLATFORMS; do
(
export KEEPDEST=1
export DEST="$DEST/$platform" # bundles/VERSION/cross/GOOS/GOARCH/docker-VERSION
mkdir -p "$DEST"
ABS_DEST="$(cd "$DEST" && pwd -P)"
@ -28,14 +29,14 @@ for platform in $DOCKER_CROSSPLATFORMS; do
export GOARCH=${platform##*/}
if [ -z "${daemonSupporting[$platform]}" ]; then
# we just need a simple client for these platforms
# we just need a simple client for these platforms
export LDFLAGS_STATIC_DOCKER=""
# remove the "daemon" build tag from platforms that aren't supported
export BUILDFLAGS=( "${ORIG_BUILDFLAGS[@]/ daemon/}" )
source "${MAKEDIR}/binary-client"
else
source "${MAKEDIR}/binary-client"
source "${MAKEDIR}/binary-daemon"
# remove the "daemon" build tag from platforms that aren't supported
export BUILDFLAGS=( "${ORIG_BUILDFLAGS[@]/ daemon/}" )
source "${MAKEDIR}/binary-client"
else
source "${MAKEDIR}/binary-client"
source "${MAKEDIR}/binary-daemon"
fi
)
done

12
hack/make/install-binary Normal file
View file

@ -0,0 +1,12 @@
#!/bin/bash
set -e
rm -rf "$DEST"
(
source "${MAKEDIR}/install-binary-client"
)
(
source "${MAKEDIR}/install-binary-daemon"
)

View file

@ -0,0 +1,10 @@
#!/bin/bash
set -e
rm -rf "$DEST"
(
DEST="$(dirname $DEST)/binary-client"
source "${MAKEDIR}/.binary-setup"
install_binary "${DEST}/${DOCKER_CLIENT_BINARY_NAME}"
)

View file

@ -0,0 +1,10 @@
#!/bin/bash
set -e
rm -rf "$DEST"
(
DEST="$(dirname $DEST)/binary-daemon"
source "${MAKEDIR}/.binary-setup"
install_binary "${DEST}/${DOCKER_DAEMON_BINARY_NAME}"
)

View file

@ -13,8 +13,11 @@ fi
for d in "$CROSS/"*/*; do
export GOARCH="$(basename "$d")"
export GOOS="$(basename "$(dirname "$d")")"
BINARY_NAME="docker-$VERSION"
DAEMON_BINARY_NAME="dockerd-$VERSION"
source "${MAKEDIR}/.binary-setup"
BINARY_NAME="${DOCKER_CLIENT_BINARY_NAME}-$VERSION"
DAEMON_BINARY_NAME="${DOCKER_DAEMON_BINARY_NAME}-$VERSION"
BINARY_EXTENSION="$(export GOOS && binary_extension)"
if [ "$GOOS" = 'windows' ]; then
# if windows use a zip, not tgz
@ -40,9 +43,9 @@ for d in "$CROSS/"*/*; do
# Copy the correct docker binary
mkdir -p $TAR_PATH
cp -L "$d/$BINARY_FULLNAME" "$TAR_PATH/docker$BINARY_EXTENSION"
cp -L "$d/$BINARY_FULLNAME" "$TAR_PATH/${DOCKER_CLIENT_BINARY_NAME}${BINARY_EXTENSION}"
if [ -f "$d/$DAEMON_BINARY_FULLNAME" ]; then
cp -L "$d/$DAEMON_BINARY_FULLNAME" "$TAR_PATH/dockerd$BINARY_EXTENSION"
cp -L "$d/$DAEMON_BINARY_FULLNAME" "$TAR_PATH/${DOCKER_DAEMON_BINARY_NAME}${BINARY_EXTENSION}"
fi
# copy over all the containerd binaries