about summary refs log tree commit diff
path: root/tools/govanity/Makefile
blob: 63925511c12290a8c7a5ebf1d9b40534eb86cb96 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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: docker-build docker-run worktree-clean server

server:
	@echo "Running server ..."
	go run .

worktree-clean:
	git diff --exit-code
	git diff --staged --exit-code

docker-build:
	@echo "Building Docker image ..."
	$(DOCKER) build $(DOCKER_BUILD_ARGS) \
		--tag "${DOCKER_IMAGE}:${DOCKER_IMAGE_REF}" \
		--file "$(DOCKERFILE)" \
		"$(PROJECT_DIR)"

docker-run: docker-build
	@echo "Running Docker image ..."
	$(DOCKER) run -ti --rm -p 8080:8080 $(DOCKER_IMAGE):$(DOCKER_IMAGE_REF)