#!/bin/sh
# script/docker: build the Docker image tagged with the project name.
# The tag comes from script/projectname. CHECK_EPOCH is passed for the
# same reason script/cibuild passes it: without a fresh value an
# unchanged tree is served from cache and this exits 0 having run no
# gate.
set -eu

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
ROOT="$(cd "$SCRIPT_DIR/.." && pwd -P)"

main() {
    cd "$ROOT"
    docker build \
        --build-arg CHECK_EPOCH="$(date +%s)-$$" \
        -t "$("$SCRIPT_DIR/projectname")" \
        .
}

main "$@"
