2021-04-10 03:38:27 +02: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 20:33:58 +02:00
|
|
|
docker:
|
2021-06-01 09:56:39 +02:00
|
|
|
docker build -t umputun/reproxy:master --progress=plain .
|
2021-04-05 20:33:58 +02:00
|
|
|
|
|
|
|
dist:
|
|
|
|
- @mkdir -p dist
|
2021-05-28 23:28:33 +02:00
|
|
|
docker build -f Dockerfile.artifacts --progress=plain -t reproxy.bin .
|
2021-04-05 20:33:58 +02:00
|
|
|
- @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 03:38:27 +02:00
|
|
|
build: info
|
2021-04-10 21:46:18 +02: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 03:38:27 +02:00
|
|
|
|
2021-05-22 17:44:21 +02:00
|
|
|
site:
|
2021-04-16 21:04:54 +02:00
|
|
|
@rm -f site/public/*
|
2021-05-28 23:28:33 +02:00
|
|
|
docker build -f Dockerfile.site --progress=plain -t reproxy.site .
|
2021-04-16 21:04:54 +02:00
|
|
|
docker run -d --name=reproxy.site reproxy.site
|
|
|
|
docker cp reproxy.site:/build/public site/
|
|
|
|
docker rm -f reproxy.site
|
2021-05-22 17:44:21 +02:00
|
|
|
rsync -avz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress ./site/public/ reproxy.io:/srv/www/reproxy.io
|
2021-04-18 05:52:39 +02:00
|
|
|
|
2021-04-10 03:38:27 +02:00
|
|
|
info:
|
|
|
|
- @echo "revision $(REV)"
|
|
|
|
|
2021-04-18 05:52:39 +02:00
|
|
|
.PHONY: dist docker race_test bin info site build_site
|