#!/bin/bash # args: $1 base Dockerfile, $2 optional tags file set -e usage () { echo Usage: ./build_base.sh [-h, --help] [tags-file] echo echo Builds the taler_local/taler_base base image, optionally echo using the 'tags-file', a text file containing environment echo variables definitions to specify to which Git tag each Taler echo component should be pulled. The following tags exist: echo TAG_LIBMHD, TAG_GNUNET, TAG_EXCHANGE, TAG_MERCHANT, echo TAG_WALLET, TAG_LIBEUFIN, TAG_MERCHANT_DEMOS, TAG_SYNC. echo If tags-file is missing, all the code will be pulled echo from master\'s HEAD. } for helpOpt in "-h" "--help"; do if test "$helpOpt" = "${1:-}"; then usage exit 0 fi done if ! which realpath > /dev/null; then echo "Please, install 'realpath' (coreutils)" fi DOCKER_FILE="$(dirname $(realpath $BASH_SOURCE))/images/base/Dockerfile" # Check base file. if ! test -a $DOCKER_FILE; then echo Base Dockerfile: $DOCKER_FILE not found. exit 1 fi # Allows extra features to conditionally copy files # from the host during the build. That solves the # case where the tag file is not given. export DOCKER_BUILDKIT=1 mkdir -p buildconfig # --help option not found in $1, check for the tags-file. if test -n "$1"; then ! test -a "$1" && (echo "Tag file: $1 not found." && exit 1) cp $1 buildconfig/tags.sh else echo "" > buildconfig/tags.sh fi docker build --no-cache \ -t taler_local/taler_base \ -f $DOCKER_FILE .