2019-06-20 16:36:40 -07:00
export GO111MODULE = on
2019-07-20 17:30:58 -07:00
TOP_LEVEL = $( shell git rev-parse --show-toplevel)
2019-08-14 12:35:51 -07:00
CONTAINER_RUNTIME := $( shell command -v podman 2> /dev/null || echo docker)
PATH := bin:$( PATH)
2019-06-20 16:36:40 -07:00
.PHONY : all
all : doc binary debug test check
.PHONY : binary
binary : doc
go build -v -o bin/zot -tags= jsoniter ./cmd/zot
.PHONY : debug
debug : doc
2019-07-09 22:23:59 -07:00
go build -v -gcflags all = '-N -l' -o bin/zot-debug -tags= jsoniter ./cmd/zot
2019-06-20 16:36:40 -07:00
.PHONY : test
test :
2019-07-20 17:30:58 -07:00
$( shell cd test/data; ./gen_certs.sh; cd ${ TOP_LEVEL } )
2019-06-26 14:31:43 -07:00
go test -v -race -cover -coverprofile= coverage.txt -covermode= atomic ./...
2019-06-20 16:36:40 -07:00
.PHONY : check
2019-08-14 12:35:51 -07:00
check :
golangci-lint --version || curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.17.1
golangci-lint run --enable-all ./cmd/... ./pkg/...
2019-06-20 16:36:40 -07:00
.PHONY : doc
doc :
swag -v || go get -u github.com/swaggo/swag/cmd/swag
swag init -g pkg/api/routes.go
.PHONY : clean
clean :
rm -f bin/zot*
.PHONY : run
run : binary test
./bin/zot serve examples/config-test.json
2019-08-14 12:35:51 -07:00
.PHONY : binary -container
binary-container :
${ CONTAINER_RUNTIME } build ${ BUILD_ARGS } -f Dockerfile -t zot:latest .
${ CONTAINER_RUNTIME } run --rm --security-opt label = disable -v $$ ( pwd ) :/go/src/github.com/anuvu/zot \
zot:latest make
2019-08-14 16:26:25 -07:00
.PHONY : binary -stacker
binary-stacker :
stacker build --substitute PWD = $$ PWD --no-cache