#!/bin/sh # script/docker: build the Docker image tagged with the project name. # The tag comes from script/projectname. # # .dockerignore excludes .git/, so the builder stage cannot derive the # version itself. It is resolved here, where the checkout is, and passed # in as a build arg; without it the image would stamp itself "unknown". set -eu SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)" ROOT="$(cd "$SCRIPT_DIR/.." && pwd -P)" main() { cd "$ROOT" docker build \ --build-arg VERSION="$("$SCRIPT_DIR/version")" \ -t "$("$SCRIPT_DIR/projectname")" . } main "$@"