#!/bin/bash
# Copyright ETSI 2018
# See: https://forge.etsi.org/etsi-forge-copyright-statement.txt

set -e
set -vx

DOCKER_FILE=./Dockerfile
if [ -f ${DOCKER_FILE} ]
then
    docker rmi -f $(docker images -q)
    docker build --tag stf525_its --force-rm --build-arg USERNAME=${USERNAME} --build-arg PASSWORD=${PASSWORD} .
    if [ "$?" != "0" ]
    then
        echo "Docker build failed: $?"
        exit -1
    fi
    docker image ls -a
    docker inspect stf525_its:latest
    if [ "$?" != "0" ]
    then
        echo "Docker inspect failed: $?"
        exit -1
    fi
else
    exit -2
fi

# That's all Floks
exit 0
