about summary refs log tree commit diff
path: root/tools/govanity/Makefile
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tools/govanity/Makefile31
1 files changed, 25 insertions, 6 deletions
diff --git a/tools/govanity/Makefile b/tools/govanity/Makefile
index e9ffe64..a826abe 100644
--- a/tools/govanity/Makefile
+++ b/tools/govanity/Makefile
@@ -1,9 +1,28 @@
-.PHONY: deploy
+DOCKER := docker
+DOCKER_BUILD_ARGS :=
+DOCKER_IMAGE := fcuny/golang.fcuny.net
+DOCKER_IMAGE_REF := $(shell git rev-parse HEAD)
+DOCKERFILE := Dockerfile
+PROJECT_DIR := $(realpath $(CURDIR))
+
+.PHONY: deploy docker-build docker-run
+
+server:
+	@echo "Running server ..."
+	go run .
+
 deploy:
-	gcloud -q app deploy --project=fcuny-govanity
+	@echo "Deploying to fly ..."
+	flyctl deploy --build-arg IMAGE_REF=$(DOCKER_IMAGE_REF)
 
-.PHONY: console
-	gcloud -q app open-console --project=fcuny-govanity
+docker-build:
+	@echo "Building Docker image ..."
+	$(DOCKER) build $(DOCKER_BUILD_ARGS) \
+		--tag "${DOCKER_IMAGE}:${DOCKER_IMAGE_REF}" \
+	  --build-arg IMAGE_REF=$(DOCKER_IMAGE_REF) \
+		--file "$(DOCKERFILE)" \
+		"$(PROJECT_DIR)"
 
-.PHONY: all
-all: deploy
+docker-run: docker-build
+	@echo "Running Docker image ..."
+	$(DOCKER) run -ti --rm -p 8080:8080 $(DOCKER_IMAGE):$(DOCKER_IMAGE_REF)