forked from imkira/gcp-iap-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (34 loc) · 1.17 KB
/
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
GIT_BRANCHTAG=$(shell git symbolic-ref -q --short HEAD || git describe --tags --exact-match)
GIT_COMMIT=$(shell git rev-parse HEAD)
GOOS?=linux
GOARCH?=amd64
GOBUILD_ENV+=CGO_ENABLED=0
GOBUILD_FLAGS+=-a -ldflags "$(GOBUILD_LDFLAGS)"
GOBUILD_LDFLAGS+=-X \"main.version=$(GIT_BRANCHTAG)\"
GOBUILD_LDFLAGS+=-X \"main.revision=$(GIT_COMMIT)\"
GOBUILD_LDFLAGS+=-s -w
DIST_OUTPUT=gcp-iap-auth-$(GOOS)-$(GOARCH)
SHASUM=shasum -a 1
VERSION=0.0.5
IMAGE=imkira/gcp-iap-auth
.PHONY: all build build-docker docker-release dist clean deps vendor
all: build
build:
go build -o "build/gcp-iap-auth"
docker-build:
docker build -t "${IMAGE}:${VERSION}" .
docker-login:
echo "${DOCKER_PASSWORD}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
docker-release:
docker tag "${IMAGE}:${VERSION}" "${IMAGE}:latest"
docker push "${IMAGE}:${VERSION}"
docker push "${IMAGE}:latest"
dist:
GOOS=$(GOOS) GOARCH=$(GOARCH) $(GOBUILD_ENV) go build $(GOBUILD_FLAGS) -o "dist/$(DIST_OUTPUT)"
cd dist && $(SHASUM) "$(DIST_OUTPUT)" > "$(DIST_OUTPUT).sha1"
clean:
rm -rf build dist
deps:
[ ! -d "${GOPATH}/src/github.com/Masterminds/glide" ] && go get -u github.com/Masterminds/glide
vendor:
glide up -v