-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
32 lines (23 loc) · 902 Bytes
/
Makefile
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
.PHONY: clean run build.local build.linux build.docker deploy
BINARY ?= duckling
SOURCES = $(shell find . -name '*.go')
VERSION ?= $(shell git describe --tags --always)
IMAGE ?= deploy.glv.one/lukee/$(BINARY)
DOCKERFILE ?= Dockerfile
BUILD_FLAGS ?= -v
LDFLAGS ?= -w -s
default: run
clean:
rm -rf build
run: build.local
./build/$(BINARY) --serverCert duckling.crt --serverKey duckling.key
build.local: build/$(BINARY)
build.linux: build/linux/$(BINARY)
build/$(BINARY): $(SOURCES)
CGO_ENABLED=0 go build -o build/$(BINARY) $(BUILD_FLAGS) -ldflags "$(LDFLAGS)" .
build/linux/$(BINARY): $(SOURCES)
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build $(BUILD_FLAGS) -o build/linux/$(BINARY) -ldflags "$(LDFLAGS)" .
build.docker: build.linux
docker build --rm -t "$(IMAGE):$(VERSION)" -f $(DOCKERFILE) .
deploy: build.docker
docker push "$(IMAGE):$(VERSION)"