2019-01-04 12:58:30 +02:00
|
|
|
include .env
|
|
|
|
BINARY := oauth2_proxy
|
2019-02-08 12:10:52 +02:00
|
|
|
VERSION := $(shell git describe --always --dirty --tags 2>/dev/null || echo "undefined")
|
2019-10-07 22:53:46 +02:00
|
|
|
# Allow to override image registry.
|
|
|
|
REGISTRY ?= quay.io/pusher
|
2019-01-07 18:41:11 +02:00
|
|
|
.NOTPARALLEL:
|
2019-01-04 12:58:30 +02:00
|
|
|
|
|
|
|
.PHONY: all
|
2019-07-13 22:24:40 +02:00
|
|
|
all: lint $(BINARY)
|
2019-01-04 12:58:30 +02:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -rf release
|
|
|
|
rm -f $(BINARY)
|
|
|
|
|
|
|
|
.PHONY: distclean
|
|
|
|
distclean: clean
|
|
|
|
rm -rf vendor
|
|
|
|
|
|
|
|
.PHONY: lint
|
2019-06-03 09:25:48 +02:00
|
|
|
lint:
|
2019-07-13 22:24:40 +02:00
|
|
|
GO111MODULE=on $(GOLANGCILINT) run
|
2019-01-04 12:58:30 +02:00
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
build: clean $(BINARY)
|
|
|
|
|
|
|
|
$(BINARY):
|
2019-07-13 22:24:40 +02:00
|
|
|
GO111MODULE=on CGO_ENABLED=0 $(GO) build -a -installsuffix cgo -ldflags="-X main.VERSION=${VERSION}" -o $@ github.com/pusher/oauth2_proxy
|
2019-01-04 12:58:30 +02:00
|
|
|
|
2019-02-02 01:08:19 +02:00
|
|
|
.PHONY: docker
|
|
|
|
docker:
|
2019-10-07 22:53:46 +02:00
|
|
|
docker build -f Dockerfile -t $(REGISTRY)/oauth2_proxy:latest .
|
2019-02-02 01:08:19 +02:00
|
|
|
|
|
|
|
.PHONY: docker-all
|
2019-02-02 03:20:20 +02:00
|
|
|
docker-all: docker
|
2019-10-07 22:53:46 +02:00
|
|
|
docker build -f Dockerfile -t $(REGISTRY)/oauth2_proxy:latest-amd64 .
|
|
|
|
docker build -f Dockerfile -t $(REGISTRY)/oauth2_proxy:${VERSION} .
|
|
|
|
docker build -f Dockerfile -t $(REGISTRY)/oauth2_proxy:${VERSION}-amd64 .
|
|
|
|
docker build -f Dockerfile.arm64 -t $(REGISTRY)/oauth2_proxy:latest-arm64 .
|
|
|
|
docker build -f Dockerfile.arm64 -t $(REGISTRY)/oauth2_proxy:${VERSION}-arm64 .
|
|
|
|
docker build -f Dockerfile.armv6 -t $(REGISTRY)/oauth2_proxy:latest-armv6 .
|
|
|
|
docker build -f Dockerfile.armv6 -t $(REGISTRY)/oauth2_proxy:${VERSION}-armv6 .
|
2019-02-08 12:05:57 +02:00
|
|
|
|
|
|
|
.PHONY: docker-push
|
|
|
|
docker-push:
|
2019-10-07 22:53:46 +02:00
|
|
|
docker push $(REGISTRY)/oauth2_proxy:latest
|
2019-02-08 12:05:57 +02:00
|
|
|
|
|
|
|
.PHONY: docker-push-all
|
|
|
|
docker-push-all: docker-push
|
2019-10-07 22:53:46 +02:00
|
|
|
docker push $(REGISTRY)/oauth2_proxy:latest-amd64
|
|
|
|
docker push $(REGISTRY)/oauth2_proxy:${VERSION}
|
|
|
|
docker push $(REGISTRY)/oauth2_proxy:${VERSION}-amd64
|
|
|
|
docker push $(REGISTRY)/oauth2_proxy:latest-arm64
|
|
|
|
docker push $(REGISTRY)/oauth2_proxy:${VERSION}-arm64
|
|
|
|
docker push $(REGISTRY)/oauth2_proxy:latest-armv6
|
|
|
|
docker push $(REGISTRY)/oauth2_proxy:${VERSION}-armv6
|
2019-02-02 01:08:19 +02:00
|
|
|
|
2019-01-04 12:58:30 +02:00
|
|
|
.PHONY: test
|
2019-07-13 22:24:40 +02:00
|
|
|
test: lint
|
|
|
|
GO111MODULE=on $(GO) test -v -race ./...
|
2019-01-04 12:58:30 +02:00
|
|
|
|
|
|
|
.PHONY: release
|
2019-01-07 18:41:11 +02:00
|
|
|
release: lint test
|
2019-01-04 12:58:30 +02:00
|
|
|
mkdir release
|
2019-05-31 10:24:45 +02:00
|
|
|
mkdir release/$(BINARY)-$(VERSION).darwin-amd64.$(GO_VERSION)
|
|
|
|
mkdir release/$(BINARY)-$(VERSION).linux-amd64.$(GO_VERSION)
|
|
|
|
mkdir release/$(BINARY)-$(VERSION).linux-arm64.$(GO_VERSION)
|
|
|
|
mkdir release/$(BINARY)-$(VERSION).linux-armv6.$(GO_VERSION)
|
|
|
|
mkdir release/$(BINARY)-$(VERSION).windows-amd64.$(GO_VERSION)
|
2019-07-13 22:24:40 +02:00
|
|
|
GO111MODULE=on GOOS=darwin GOARCH=amd64 go build -ldflags="-X main.VERSION=${VERSION}" \
|
2019-05-31 10:24:45 +02:00
|
|
|
-o release/$(BINARY)-$(VERSION).darwin-amd64.$(GO_VERSION)/$(BINARY) github.com/pusher/oauth2_proxy
|
2019-07-13 22:24:40 +02:00
|
|
|
GO111MODULE=on GOOS=linux GOARCH=amd64 go build -ldflags="-X main.VERSION=${VERSION}" \
|
2019-05-31 10:24:45 +02:00
|
|
|
-o release/$(BINARY)-$(VERSION).linux-amd64.$(GO_VERSION)/$(BINARY) github.com/pusher/oauth2_proxy
|
2019-07-13 22:24:40 +02:00
|
|
|
GO111MODULE=on GOOS=linux GOARCH=arm64 go build -ldflags="-X main.VERSION=${VERSION}" \
|
2019-05-31 10:24:45 +02:00
|
|
|
-o release/$(BINARY)-$(VERSION).linux-arm64.$(GO_VERSION)/$(BINARY) github.com/pusher/oauth2_proxy
|
2019-07-13 22:24:40 +02:00
|
|
|
GO111MODULE=on GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-X main.VERSION=${VERSION}" \
|
2019-05-31 10:24:45 +02:00
|
|
|
-o release/$(BINARY)-$(VERSION).linux-armv6.$(GO_VERSION)/$(BINARY) github.com/pusher/oauth2_proxy
|
2019-07-13 22:24:40 +02:00
|
|
|
GO111MODULE=on GOOS=windows GOARCH=amd64 go build -ldflags="-X main.VERSION=${VERSION}" \
|
2019-05-31 10:24:45 +02:00
|
|
|
-o release/$(BINARY)-$(VERSION).windows-amd64.$(GO_VERSION)/$(BINARY) github.com/pusher/oauth2_proxy
|
|
|
|
shasum -a 256 release/$(BINARY)-$(VERSION).darwin-amd64.$(GO_VERSION)/$(BINARY) > release/$(BINARY)-$(VERSION).darwin-amd64-sha256sum.txt
|
|
|
|
shasum -a 256 release/$(BINARY)-$(VERSION).linux-amd64.$(GO_VERSION)/$(BINARY) > release/$(BINARY)-$(VERSION).linux-amd64-sha256sum.txt
|
|
|
|
shasum -a 256 release/$(BINARY)-$(VERSION).linux-arm64.$(GO_VERSION)/$(BINARY) > release/$(BINARY)-$(VERSION).linux-arm64-sha256sum.txt
|
|
|
|
shasum -a 256 release/$(BINARY)-$(VERSION).linux-armv6.$(GO_VERSION)/$(BINARY) > release/$(BINARY)-$(VERSION).linux-armv6-sha256sum.txt
|
|
|
|
shasum -a 256 release/$(BINARY)-$(VERSION).windows-amd64.$(GO_VERSION)/$(BINARY) > release/$(BINARY)-$(VERSION).windows-amd64-sha256sum.txt
|
|
|
|
tar -C release -czvf release/$(BINARY)-$(VERSION).darwin-amd64.$(GO_VERSION).tar.gz $(BINARY)-$(VERSION).darwin-amd64.$(GO_VERSION)
|
|
|
|
tar -C release -czvf release/$(BINARY)-$(VERSION).linux-amd64.$(GO_VERSION).tar.gz $(BINARY)-$(VERSION).linux-amd64.$(GO_VERSION)
|
|
|
|
tar -C release -czvf release/$(BINARY)-$(VERSION).linux-arm64.$(GO_VERSION).tar.gz $(BINARY)-$(VERSION).linux-arm64.$(GO_VERSION)
|
|
|
|
tar -C release -czvf release/$(BINARY)-$(VERSION).linux-armv6.$(GO_VERSION).tar.gz $(BINARY)-$(VERSION).linux-armv6.$(GO_VERSION)
|
|
|
|
tar -C release -czvf release/$(BINARY)-$(VERSION).windows-amd64.$(GO_VERSION).tar.gz $(BINARY)-$(VERSION).windows-amd64.$(GO_VERSION)
|