#!/bin/bash -e TAG="1.5-$(date +%Y%m%d)" build() { image=$1 echo "[INFO] Building ${image}" docker build -t ${image} . docker push ${image} } if [ -z "$1" ]; then find . -name Dockerfile | while read i; do dir=$(dirname $i) pushd ${dir} >/dev/null image="genunix/mailu-$(basename $dir):${TAG}" build ${image} popd >/dev/null done else dir=$(basename $1) image="genunix/mailu-$(basename $dir):${TAG}" pushd "$1" >/dev/null build "$image" popd >/dev/null fi