#!/bin/sh
# script/docker: build the Docker image tagged with the project name.
# The tag comes from script/projectname.
#
# --no-cache-filter=lint,builder forces the lint stage and the builder
# stage (make test) to run on every invocation. Without it an unchanged
# tree serves them from the layer cache, producing an image whose build
# linted nothing and queried no live DNS.
set -eu

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

main() {
    cd "$ROOT"
    docker build --no-cache-filter=lint,builder -t "$("$SCRIPT_DIR/projectname")" .
}

main "$@"
