#!/usr/bin/env bash usage() { printf "$0 usage: \n -b: force build all\n -v Postgres version\n" $0 exit 0 } forceBuild=N while getopts ":hd:bv:" arg; do case $arg in b) forceBuild=Y ;; v) version=${OPTARG} ;; h | *) usage ;; esac done version="${version-13.3}" if [ -z "$(docker images -q api:prod)" ] || [ "$forceBuild" = 'Y' ]; then export API=data/sample-api-users docker build $API -f $API/Dockerfile.prod -t api:prod fi if [ -z "$(docker images -q client:prod)" ] || [ "$forceBuild" = 'Y' ]; then export CLIENT=data/sample-client-users docker build $CLIENT -f $CLIENT/Dockerfile -t client:prod fi if [ -z "$(docker images -q db:${version})" ] || [ "$forceBuild" = 'Y' ]; then export DB=data/db docker build $DB -f $DB/Dockerfile --build-arg "VERSION=${version}" -t "db:${version}" fi