2021-04-10 04:38:27 +03:00
|
|
|
B=$(shell git rev-parse --abbrev-ref HEAD)
|
|
|
|
BRANCH=$(subst /,-,$(B))
|
|
|
|
GITREV=$(shell git describe --abbrev=7 --always --tags)
|
|
|
|
REV=$(GITREV)-$(BRANCH)-$(shell date +%Y%m%d-%H:%M:%S)
|
|
|
|
|
2021-04-05 21:33:58 +03:00
|
|
|
docker:
|
2021-04-12 10:09:34 +03:00
|
|
|
docker build -t umputun/reproxy:master .
|
2021-04-05 21:33:58 +03:00
|
|
|
|
|
|
|
dist:
|
|
|
|
- @mkdir -p dist
|
|
|
|
docker build -f Dockerfile.artifacts -t reproxy.bin .
|
|
|
|
- @docker rm -f reproxy.bin 2>/dev/null || exit 0
|
|
|
|
docker run -d --name=reproxy.bin reproxy.bin
|
|
|
|
docker cp reproxy.bin:/artifacts dist/
|
|
|
|
docker rm -f reproxy.bin
|
|
|
|
|
|
|
|
race_test:
|
|
|
|
cd app && go test -race -mod=vendor -timeout=60s -count 1 ./...
|
|
|
|
|
2021-04-10 04:38:27 +03:00
|
|
|
build: info
|
2021-04-10 22:46:18 +03:00
|
|
|
- cd app && GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X main.revision=$(REV) -s -w" -o ../dist/reproxy
|
2021-04-10 04:38:27 +03:00
|
|
|
|
|
|
|
info:
|
|
|
|
- @echo "revision $(REV)"
|
|
|
|
|
|
|
|
.PHONY: dist docker race_test bin info
|