diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-02-08 07:30:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-02-08 07:30:37 +0000 |
commit | 8a7b72f7cd1ccd547a03eb4243294e741d661d3f (patch) | |
tree | 7bc7be4a8e9e298daa1349348400aa2a653866f2 /packaging/docker/build.sh | |
parent | New upstream version 1.11.1+dfsg (diff) | |
download | netdata-8a7b72f7cd1ccd547a03eb4243294e741d661d3f.tar.xz netdata-8a7b72f7cd1ccd547a03eb4243294e741d661d3f.zip |
Adding upstream version 1.12.0.upstream/1.12.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-x | packaging/docker/build.sh (renamed from docker/build.sh) | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/docker/build.sh b/packaging/docker/build.sh index faaa2db79..6958f05e8 100755 --- a/docker/build.sh +++ b/packaging/docker/build.sh @@ -6,6 +6,11 @@ set -e +if [ ! -f .gitignore ]; then + echo "Run as ./packaging/docker/$(basename "$0") from top level directory of git repository" + exit 1 +fi + if [ "$1" == "" ]; then VERSION=$(git tag --points-at) else @@ -15,36 +20,41 @@ if [ "${VERSION}" == "" ]; then VERSION="latest" fi -REPOSITORY="${REPOSITORY:-netdata}" - -echo "Building $VERSION of netdata container" - declare -A ARCH_MAP ARCH_MAP=( ["i386"]="386" ["amd64"]="amd64" ["armhf"]="arm" ["aarch64"]="arm64") +if [ -z ${DEVEL+x} ]; then + declare -a ARCHITECTURES=(i386 armhf aarch64 amd64) +else + declare -a ARCHITECTURES=(amd64) + unset DOCKER_PASSWORD + unset DOCKER_USERNAME +fi -docker run --rm --privileged multiarch/qemu-user-static:register --reset +REPOSITORY="${REPOSITORY:-netdata}" +echo "Building ${VERSION} of ${REPOSITORY} container" -if [ -f Dockerfile ]; then - cd ../ || exit 1 -fi +docker run --rm --privileged multiarch/qemu-user-static:register --reset # Build images using multi-arch Dockerfile. -for ARCH in i386 armhf aarch64 amd64; do - docker build --build-arg ARCH="${ARCH}-v3.8" \ - --tag "${REPOSITORY}:${VERSION}-${ARCH}" \ - --file docker/Dockerfile ./ & +for ARCH in "${ARCHITECTURES[@]}"; do + eval docker build \ + --build-arg ARCH="${ARCH}-v3.8" \ + --build-arg OUTPUT=/dev/null \ + --tag "${REPOSITORY}:${VERSION}-${ARCH}" \ + --file packaging/docker/Dockerfile ./ done -wait + +# There is no reason to continue if we cannot log in to docker hub +if [ -z ${DOCKER_USERNAME+x} ] || [ -z ${DOCKER_PASSWORD+x} ]; then + echo "No docker hub username or password specified. Exiting without pushing images to registry" + exit 0 +fi # Create temporary docker CLI config with experimental features enabled (manifests v2 need it) mkdir -p /tmp/docker echo '{"experimental":"enabled"}' > /tmp/docker/config.json -# Login to docker hub to allow for futher operations -if [ -z ${DOCKER_USERNAME+x} ] || [ -z ${DOCKER_PASSWORD+x} ]; then - echo "No docker hub username or password specified. Exiting without pushing images to registry" - exit 1 -fi +# Login to docker hub to allow futher operations echo "$DOCKER_PASSWORD" | docker --config /tmp/docker login -u "$DOCKER_USERNAME" --password-stdin # Push images to registry @@ -71,4 +81,3 @@ docker --config /tmp/docker manifest push -p "${REPOSITORY}:${VERSION}" # Show current manifest (debugging purpose only) docker --config /tmp/docker manifest inspect "${REPOSITORY}:${VERSION}" - |