<commit_before>#!/usr/bin/env bash
# ----------------------------------------------------------
# PURPOSE

# This is the build script for the Monax stack. It will
# build the tool into docker containers in a reliable and
# predictable manner.

# ----------------------------------------------------------
# REQUIREMENTS
#
# docker, go, make, and git installed locally

# ----------------------------------------------------------
# USAGE

# build_tool.sh [version tag]

# ----------------------------------------------------------

set -e

script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# Grab date, commit, version
. "$script_dir/local_version.sh" > /dev/null

DOCKER_REPO=${DOCKER_REPO:-"hyperledger/burrow"}
REPO=${REPO:-"$GOPATH/src/github.com/hyperledger/burrow"}

function log() {
    echo "$*" >> /dev/stderr
}

if [[ "$1" ]] ; then
    # If argument provided, use it as the version tag
    log "Overriding detected version $version and tagging image as $1"
    version="$1"
fi

docker build \
  --label org.label-schema.version=${version}\
  --label org.label-schema.vcs-ref=${commit}\
  --label org.label-schema.build-date=${date}\
  -t ${DOCKER_REPO}:${version} ${REPO}

# Quick smoke test
echo "Emitting version from docker image as smoke test..."
docker run ${DOCKER_REPO}:${version} -v<commit_msg>Add quay expiry to images<commit_after>#!/usr/bin/env bash
# ----------------------------------------------------------
# PURPOSE

# This is the build script for the Monax stack. It will
# build the tool into docker containers in a reliable and
# predictable manner.

# ----------------------------------------------------------
# REQUIREMENTS
#
# docker, go, make, and git installed locally

# ----------------------------------------------------------
# USAGE

# build_tool.sh [version tag]

# ----------------------------------------------------------

set -e

script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# Grab date, commit, version
. "$script_dir/local_version.sh" > /dev/null

DOCKER_REPO=${DOCKER_REPO:-"hyperledger/burrow"}
REPO=${REPO:-"$GOPATH/src/github.com/hyperledger/burrow"}

function log() {
    echo "$*" >> /dev/stderr
}

if [[ "$1" ]] ; then
    # If argument provided, use it as the version tag
    log "Overriding detected version $version and tagging image as $1"
    version="$1"
fi

# Expiry is intended for dev images, if we want more persistent Burrow images on quay.io we should remove this...
docker build \
  --label quay.expires-after=24w\
  --label org.label-schema.version=${version}\
  --label org.label-schema.vcs-ref=${commit}\
  --label org.label-schema.build-date=${date}\
  -t ${DOCKER_REPO}:${version} ${REPO}

# Quick smoke test
echo "Emitting version from docker image as smoke test..."
docker run ${DOCKER_REPO}:${version} -v
{'fraction_non_alphanumeric': 0.2921108742004264, 'fraction_numerical': 0.0035536602700781805, 'mean_word_length': 1.950733752620545, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7620805', 'n_tokens_mistral': 849, 'n_tokens_neox': 816, 'n_words': 240}