#!/usr/bin/env bash set -e set -x # include common parts source ./cli/_bootstrap.sh dc() { export PROM_VERSION=${PROM_VERSION} # shellcheck disable=SC2068 docker-compose \ -f docker-compose.yml \ -f docker-compose.build.yml \ $@ } #### build() { echo -e "\e[33m building the image\e[39m" dc build } build_test() { echo -e "\e[33m testing the image\e[39m" dc run --rm --entrypoint prometheus prometheus --version | grep ${PROM_VERSION} #test for smbclient installed # dc run --rm --user www-data app which smbclient } build_save() { echo -e "\e[33m saving the image\e[39m" docker tag "$LOCAL_IMAGE:$TAG" "$REMOTE_IMAGE" docker push "$REMOTE_IMAGE" } print_usage() { printf "Usage: %s: [-b] [-t] [-s] \n" "$0" echo -b build echo -t test echo -s push to registry echo -h help exit 0 } ###### if [ -z "$1" ]; then build && build_test && build_save exit fi while getopts btdhs name do case $name in b) build;; t) build_test;; s) build_save;; *) print_usage;; esac done