# docker command runs under sudo; for reasoning, see: https://fosterelli.co/privilege-escalation-via-docker.html -include Makefile.local DOCKER_ORG ?= local DOCKERGO := sudo docker run --rm -it --user $(shell id -u) -v $(shell pwd):/src/ -w /src -e GOCACHE=/src/.cache golang:1.14 .PHONY: build test deps clean depclean build: mkdir -p build GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o build/urizen ./cmd/urizen/main.go test: go test -cover -v ./... # Wrappers for users without golang available locally. docker_build: ${DOCKERGO} make build docker_test: ${DOCKERGO} make test clean: rm -rf build/ depclean: clean rm -rf vendor/ docker: sudo docker build -t ${DOCKER_ORG}/urizen .