mbt-node14-java17-docker mbt-node16-java17-docker mbt-node18-java17-docker \
mbt-node14-java19-docker mbt-node16-java19-docker mbt-node18-java19-docker"
+repositories="mbt-node14-java11-docker mbt-node16-java11-docker mbt-node18-java11-docker \
+ mbt-node14-java17-docker mbt-node16-java17-docker mbt-node18-java17-docker \
+ mbt-node14-java19-docker mbt-node16-java19-docker mbt-node18-java19-docker"
+
usage() {
- echo "Usage: $0 [-n <${images// /|}|all>" 1>&2; exit 1;
+ echo "Usage: ./$(basename $0) [-b <${images// /|}|all>] [-p <${repositories// /|}|all>] [-c]" 1>&2; exit 1;
}
-all() {
+build_all() {
for image in ${images}; do
make NAME=${image}
done
}
+push_all() {
+ for repository in ${repositories}; do
+ make docker-push-registry NAME=${repository}
+ done
+}
+
[ $# -eq 0 ] && usage
-while getopts "n:h" option; do
+while getopts ":b:p:ch" option; do
case "${option}" in
- n)
+ b)
name=${OPTARG}
if [[ ${name} == "all" ]]; then
- all
+ build_all
elif [[ -z "${images##*$name*}" ]]; then
make NAME=${name}
else
- echo "Error: Unknown image name for option argument -${OPTARG}" >&2;
+ echo "Error: Unknown image name as option argument '${OPTARG}'" >&2;
usage
fi
;;
- \?)
- # Invalid option
- echo "Error: Unknown or invalid option argument for -${OPTARG}" >&2;
- usage
+ p)
+ repository=${OPTARG}
+ if [[ ${repository} == "all" ]]; then
+ push_all
+ elif [[ -z "${repositories##*$repository*}" ]]; then
+ make docker-push-registry NAME=${repository}
+ else
+ echo "Error: Unknown repository name as option argument '${OPTARG}'" >&2;
+ usage
+ fi
+ ;;
+ c)
+ make dist-clean
;;
:)
- echo "Error: Missing option argument for -${OPTARG}" >&2;
+ echo "Error: Missing option argument for '-${OPTARG}'" >&2;
+ usage
+ ;;
+ \?)
+ # Invalid option
+ echo "Error: Unknown or invalid option for '-${OPTARG}'" >&2;
usage
;;
*|h)