2019-06-20 18:36:40 -05:00
|
|
|
export GO111MODULE=on
|
2019-07-20 19:30:58 -05:00
|
|
|
TOP_LEVEL=$(shell git rev-parse --show-toplevel)
|
2019-08-14 14:35:51 -05:00
|
|
|
CONTAINER_RUNTIME := $(shell command -v podman 2> /dev/null || echo docker)
|
|
|
|
PATH := bin:$(PATH)
|
2019-06-20 18:36:40 -05: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-10 00:23:59 -05:00
|
|
|
go build -v -gcflags all='-N -l' -o bin/zot-debug -tags=jsoniter ./cmd/zot
|
2019-06-20 18:36:40 -05:00
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
test:
|
2019-07-20 19:30:58 -05:00
|
|
|
$(shell cd test/data; ./gen_certs.sh; cd ${TOP_LEVEL})
|
2019-06-26 16:31:43 -05:00
|
|
|
go test -v -race -cover -coverprofile=coverage.txt -covermode=atomic ./...
|
2019-06-20 18:36:40 -05:00
|
|
|
|
|
|
|
.PHONY: check
|
2019-08-14 14:35:51 -05: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 18:36:40 -05: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 14:35:51 -05: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
|