#!/usr/bin/env sh

if [ "$DOCKER_TAG" = "latest" ]; then
  echo "Building :latest, without VERSION_ARG"
  TAG=`curl -s https://api.github.com/repos/philres/ngmlr/releases | grep tag_name | head -n 1 | cut -d '"' -f 4`
  echo $TAG
  docker build --build-arg VERSION_ARG="$TAG" -t ${IMAGE_NAME} .
else
  echo "Building :$DOCKER_TAG, with VERSION_ARG=\"--vers $DOCKER_TAG\""
  docker build --build-arg VERSION_ARG="$DOCKER_TAG" -t ${IMAGE_NAME} .
fi


#  if [ "$DOCKER_TAG" = "master" ]; then
#    echo "Building :$DOCKER_TAG, from git"
#    docker build --build-arg VERSION_ARG="" -f Dockerfile.git -t ${IMAGE_NAME} .
#  else
#  fi