#!/bin/bash for file in Dockerfile* do app=$(echo $file | sed 's/Dockerfile.//g') docker build -f $file . || exit 1 export TAG=$(docker images|grep -v REPO|head -n1|awk '{print $3}') docker tag $TAG localhost:5000/$app:latest || exit 1 docker push localhost:5000/$app:latest || exit 1 done docker-compose -f ../dockprom/docker-compose.yml down --remove-orphans || exit 1 for file in Dockerfile* do app=$(echo $file | sed 's/Dockerfile.//g') for i in $(docker images|grep $app|awk '{print $3}') ; do docker rmi $i ; done || exit 1 done docker-compose -f ../dockprom/docker-compose.yml up -d || exit 1