1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#!/bin/bash
set -e
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BASE="$(basename "$0")"
cd "$DIR"
if [ "$1" != "build" ] && \
[ "$1" != "pull" ] && \
[ "$1" != "push" ] && \
[ "$1" != "list" ]; then
echo -e "Usage: $BASE arg\n" \
"arg should be build, pull, push or list" >&2
exit 1
fi
for dir in */*; do
DOCIMG=$(printf "$dir\n" | sed 's#/##' | sed 's#^#curtine/libreswan:#')
if [ "$1" == "build" ]; then
/bin/bash -c "cd $dir && docker build -t $DOCIMG ."
continue
fi
if [ "$1" == "list" ]; then
printf "$DOCIMG\n"
continue
fi
docker "$1" "$DOCIMG"
done
|