#!/usr/bin/env bash
set -e

#if [[ -z "${DKREGISTRY_PASS}" ]]; then
#    docker login -u richard -p $DKREGISTRY_PASS $DKREGISTRY
#fi

docker build --rm -f Dockerfile-2.0 -t xaicorp/ansible:2.0 .
docker run --rm --entrypoint ansible xaicorp/ansible:2.0 --version | grep 'ansible 2.0.'
docker tag xaicorp/ansible:2.0 dkregistry.xai-corp.net:5000/xaicorp/ansible:2.0
docker push dkregistry.xai-corp.net:5000/xaicorp/ansible:2.0

docker build --rm -f Dockerfile-2.4 -t xaicorp/ansible:2.4 .
docker run --rm --entrypoint ansible xaicorp/ansible:2.4 --version | grep 'ansible 2.4.'
docker tag xaicorp/ansible:2.4 dkregistry.xai-corp.net:5000/xaicorp/ansible:2.4
docker push dkregistry.xai-corp.net:5000/xaicorp/ansible:2.4

docker build --rm -f Dockerfile-2.5 -t xaicorp/ansible:2.5 .
docker run --rm --entrypoint ansible xaicorp/ansible:2.5 --version | grep 'ansible 2.5.'
docker tag xaicorp/ansible:2.5 dkregistry.xai-corp.net:5000/xaicorp/ansible:2.5
docker push dkregistry.xai-corp.net:5000/xaicorp/ansible:2.5

docker build --rm -f Dockerfile-2.7 -t xaicorp/ansible:2.7 .
docker run --rm --entrypoint ansible xaicorp/ansible:2.7 --version | grep 'ansible 2.7.'
docker tag xaicorp/ansible:2.7 dkregistry.xai-corp.net:5000/xaicorp/ansible:2.7
docker push dkregistry.xai-corp.net:5000/xaicorp/ansible:2.7

docker tag xaicorp/ansible:2.5 xaicorp/ansible:latest
docker tag xaicorp/ansible:latest dkregistry.xai-corp.net:5000/xaicorp/ansible:latest
docker push dkregistry.xai-corp.net:5000/xaicorp/ansible:latest
