#!/bin/bash

if [ $# == 0 ];then
  args=("web_vue" "api_iris" "api_django")
else
  args=$@
fi
for arg in ${args[*]};do
  if [ $arg == "" ]; then
    continue
  fi
  if [ "$(sudo docker images -q $arg:1.0 2> /dev/null)" != "" ];
  then
      echo $arg------remove
      sudo docker rmi $arg:1.0
  fi
  echo $arg------building
  if [ $arg == "web_vue" ];then
    sudo docker build -t $arg:1.0 .
  else
    sudo docker build -t $arg:1.0 ./$arg
  fi
  echo $arg------complete
done

docker-compose up -d
echo complete
