-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
44 lines (32 loc) · 815 Bytes
/
Makefile
File metadata and controls
44 lines (32 loc) · 815 Bytes
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
GO ?= go
BINARY_NAME = inca
# GOFLAGS := -mod=vendor
STATIC := 1
VERSION := $(shell git describe --abbrev=0 --tags)
GIT_REPO := registry.ekbl.net/sistemi/inca
DOCKER ?= docker
DOCKER_TAG = $(GIT_REPO):$(VERSION)
LDFLAGS = -X main.version=$(VERSION)
# ifeq ($(STATIC), 1)
# LDFLAGS += -s -w -extldflags "-static"
# endif
.PHONY: all
all: build run
clean:
rm $(BINARY_NAME)
mod-init:
$(GO) mod init $(GIT_REPO)
mod-deps:
$(GO) mod tidy
# $(GO) mod vendor
init: mod-init mod-deps
build: mod-deps
GOOS=linux GOARCH=amd64 $(GO) build $(GOFLAGS) -ldflags '$(LDFLAGS)' -v -o $(BINARY_NAME) .
docker-build:
$(DOCKER) build -t $(DOCKER_TAG) .
run: build
./$(BINARY_NAME)
docker-run:
$(DOCKER) run -it -v --network host ${PWD}/inca.yml:/etc/inca:ro $(DOCKER_TAG)
docker-push:
$(DOCKER) push $(DOCKER_TAG)