#!/bin/bash

# Builds (or pulls) our base runtime docker image.

set -eu

if [ $# -ne 0 ]; then
    echo "no arguments allowed for $(basename $0), given: $@" >&2
    exit 64
fi

bindir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
rootdir="$( cd $bindir/.. && pwd )"

. $bindir/_docker.sh

tag="2017-10-30.01"

if (docker_pull base "${tag}"); then
    echo "$(docker_repo base):${tag}"
else
    docker_build base "${tag}" $rootdir/Dockerfile-base
fi
