#!/bin/sh

if [ "x$1" == "xdocker" ] ; then
	docker build --rm -t hexasoftware.com:5000/myapp .
	exit
fi


mkdir -p DIST/bin
mkdir -p DIST/public

GOPATH=$(pwd)/backend/vendor:$(pwd)/backend

echo "GOPATH is:" $GOPATH

echo "Fetching go dependencies:" $GOPATH
pushd backend/src/simple-web/cmd/server
go get -v
popd

# Backend
echo "Building backend..."
CGO_ENABLED=0 go build -o DIST/bin/server backend/src/simple-web/cmd/server/server.go
echo "Building frontend..."
pushd frontend/web
node build/build.js
popd

