2021-10-27 13:43:21 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
2021-11-02 17:06:24 -04:00
|
|
|
# This script will build the vinyldns-api.jar file using Docker. The file will
|
|
|
|
# be placed in the configured location (currently `artifacts/` off of the root)
|
2021-10-27 13:43:21 -04:00
|
|
|
#
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
DIR=$(
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
pwd -P
|
|
|
|
)
|
|
|
|
|
|
|
|
usage() {
|
2021-11-02 17:06:24 -04:00
|
|
|
echo "USAGE: assemble_api.sh [options]"
|
2021-12-03 12:16:21 -05:00
|
|
|
echo -e "\t-n, --no-cache do not use cache when building the artifact"
|
2021-10-27 13:43:21 -04:00
|
|
|
echo -e "\t-u, --update update the underlying docker image"
|
|
|
|
}
|
|
|
|
|
2021-12-03 12:16:21 -05:00
|
|
|
NO_CACHE=0
|
2021-10-27 13:43:21 -04:00
|
|
|
UPDATE_DOCKER=0
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
|
case "$1" in
|
2021-12-03 12:16:21 -05:00
|
|
|
--no-cache | -n)
|
|
|
|
NO_CACHE=1
|
2021-10-27 13:43:21 -04:00
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--update | -u)
|
|
|
|
UPDATE_DOCKER=1
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2021-12-03 12:16:21 -05:00
|
|
|
if [[ $NO_CACHE -eq 1 ]]; then
|
|
|
|
rm -rf "${DIR}/../artifacts/vinyldns-api.jar" &> /dev/null || true
|
|
|
|
docker rmi vinyldns:api-artifact &> /dev/null || true
|
2021-10-27 13:43:21 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $UPDATE_DOCKER -eq 1 ]]; then
|
2021-12-03 12:16:21 -05:00
|
|
|
echo "Pulling latest version of 'vinyldns/build:base-build'"
|
|
|
|
docker pull vinyldns/build:base-build
|
2021-10-27 13:43:21 -04:00
|
|
|
fi
|
|
|
|
|
2021-11-02 17:06:24 -04:00
|
|
|
echo "Building VinylDNS API artifact"
|
2021-12-03 12:16:21 -05:00
|
|
|
make -C "${DIR}/docker/api" artifact
|