#!/bin/sh
docker stop radegast
docker rm radegast
#
npm run build:production --prefix ../frontend
#
mvn clean install docker:build -DskipTests=true
#mvn docker:build -DskipTests=true
#
if [ "$1" == "push"  ]
	then
		docker push jhdockerhub/radegast:latest
fi
#
#docker run -p127.0.0.1:7070:7070 --restart=unless-stopped -e HOSTNAME_BASE=http://localhost:3030 --link postgresdb:postgresdb --link mailserver:mailserver -v /cygdrive/c/data/suite:/var/data -v /cygdrive/c/data/fonts:/var/fonts -d --name suite jhdockerhub/suite:latest 
#
docker run -p127.0.0.1:7071:7071 --log-opt max-size=50m -e HOSTNAME_BASE=http://localhost:3031 --restart=unless-stopped --link postgresdb:postgresdb -v C:/data/radegast:/var/data -v C:/data/fonts:/var/fonts -d --name radegast jhdockerhub/radegast:latest --spring.mail.host=docker.for.win.localhost --spring.profiles.active=dev
#
docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi -f