-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (38 loc) · 1.36 KB
/
Makefile
File metadata and controls
51 lines (38 loc) · 1.36 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
DOCKER_REGISTRY = index.docker.io
IMAGE_NAME = httpstaticd
IMAGE_VERSION = latest
IMAGE_ORG = flaccid
IMAGE_TAG = $(DOCKER_REGISTRY)/$(IMAGE_ORG)/$(IMAGE_NAME):$(IMAGE_VERSION)
WORKING_DIR := $(shell pwd)
.DEFAULT_GOAL := docker-build
.PHONY: docker-release
deps:: ## installs go deps recursively
@cd cmd/httpstaticd && go get ./...
update-modules:: ## updates the go modules
@go mod tidy
run:: ## runs the main program with go
@go run cmd/httpstaticd/httpstaticd.go $(ARGS)
build:: ## builds the main program with go
@go build -o bin/httpstaticd cmd/httpstaticd/httpstaticd.go
docker-build:: ## builds the docker image locally
@docker build --pull \
-t $(IMAGE_TAG) $(WORKING_DIR)
docker-run:: ## runs the docker image locally
@docker run \
-it \
$(DOCKER_REGISTRY)/$(IMAGE_ORG)/$(IMAGE_NAME):$(IMAGE_VERSION)
docker-push:: ## pushes the docker image to the registry
@docker push $(IMAGE_TAG)
docker-release:: docker-build docker-push ## builds and pushes the docker image to the registry
# A help target including self-documenting targets (see the awk statement)
define HELP_TEXT
Usage: make [TARGET]... [MAKEVAR1=SOMETHING]...
Available targets:
endef
export HELP_TEXT
help: ## this help target
@cat .banner
@echo
@echo "$$HELP_TEXT"
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / \
{printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)