#!/bin/bash

if [ "$(sudo docker images -q web_ylsa:1.0 2> /dev/null)" != "" ];
then
    echo web_ylsa------remove
    sudo docker rmi web_ylsa:1.0
fi

if [ "$(sudo docker images -q api_iris:1.0 2> /dev/null)" != "" ];
then
    echo api_iris------remove
    sudo docker rmi api_iris:1.0
fi

if [ "$(sudo docker images -q api_django:1.0 2> /dev/null)" != "" ];
then
    echo api_django------remove
    sudo docker rmi api_django:1.0
fi

echo web_ylsa------building
sudo docker build -t web_ylsa:1.0 .
echo web_ylsa------complete

echo api_iris------building
sudo docker build -t api_iris:1.0 ./api_iris
echo api_iris------complete

echo api_django------building
docker build -t api_django:1.0 ./api_django
echo api_django------complete

docker-compose up -d
echo complete
