forked from ory/keto
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (57 loc) · 2.07 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
SHELL=/bin/bash -o pipefail
EXECUTABLES = docker-compose docker node npm go
K := $(foreach exec,$(EXECUTABLES),\
$(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH")))
export GO111MODULE := on
export PATH := .bin:${PATH}
.PHONY: deps
deps:
ifneq ("$(shell base64 Makefile))","$(shell cat .bin/.lock)")
go build -o .bin/go-acc github.com/ory/go-acc
go build -o .bin/goreturns github.com/sqs/goreturns
go build -o .bin/listx github.com/ory/x/tools/listx
go build -o .bin/mockgen github.com/golang/mock/mockgen
go build -o .bin/swagger github.com/go-swagger/go-swagger/cmd/swagger
go build -o .bin/goimports golang.org/x/tools/cmd/goimports
go build -o .bin/ory github.com/ory/cli
go build -o .bin/packr github.com/gobuffalo/packr/packr
go build -o .bin/go-bindata github.com/go-bindata/go-bindata/go-bindata
echo "v0" > .bin/.lock
echo "$$(base64 Makefile)" > .bin/.lock
endif
.PHONY: format
format: deps
goreturns -w -local github.com/ory $$(listx .)
.PHONY: install-stable
install-stable: deps
KETO_LATEST=$$(git describe --abbrev=0 --tags)
git checkout $$KETO_LATEST
packr
GO111MODULE=on go install \
-ldflags "-X github.com/ory/keto/cmd.Version=$$KETO_LATEST -X github.com/ory/keto/cmd.Date=`TZ=UTC date -u '+%Y-%m-%dT%H:%M:%SZ'` -X github.com/ory/keto/cmd.Commit=`git rev-parse HEAD`" \
.
packr clean
git checkout master
.PHONY: install
install: deps
packr
GO111MODULE=on go install .
packr clean
# Generates the SDKs
.PHONY: sdk
sdk: deps
swagger generate spec -m -o ./.schema/api.swagger.json -x internal/httpclient
ory dev swagger sanitize ./.schema/api.swagger.json
swagger flatten --with-flatten=remove-unused -o ./.schema/api.swagger.json ./.schema/api.swagger.json
swagger validate ./.schema/api.swagger.json
rm -rf internal/httpclient
mkdir -p internal/httpclient
swagger generate client -f ./.schema/api.swagger.json -t internal/httpclient -A Ory_Keto
make format
.PHONY: docker
docker: deps
packr
GO111MODULE=on GOOS=linux GOARCH=amd64 go build
docker build -t oryd/keto:latest .
rm keto
packr clean