

all: backend frontend

docker: Dockerfile
	docker build --rm -t hexasoftware.com:5000/myapp .

deploy: docker
	docker push hexasoftware.com:5000/myapp

backend: distpath 
	@echo "Building backend...  $(pwd)"
	CGO_ENABLED=0 go build -o DIST/bin/server backend/src/simple-web/server/server.go

frontend: distpath 
	@echo "Building frontend..."
	# Frontend
	@cd frontend/web;node build/build.js

test: backend
	cd DIST;tmux split "DBHOST=localhost PORT=8080 DEVMODE=1 bin/server"
	cd frontend/web; npm run dev

distpath:
	@mkdir -p DIST/bin
	@mkdir -p DIST/public


.PHONY: all test clean backend frontend


