github.com/dawnbass68/maddcash@v0.0.0-20201001105353-c91c12cb36e5/Makefile (about) 1 BIN_IMAGE = blockbook-build 2 DEB_IMAGE = blockbook-build-deb 3 PACKAGER = $(shell id -u):$(shell id -g) 4 NO_CACHE = false 5 UPDATE_VENDOR = 1 6 ARGS ?= 7 8 TARGETS=$(subst .json,, $(shell ls configs/coins)) 9 10 .PHONY: build build-debug test deb 11 12 build: .bin-image 13 docker run -t --rm -e PACKAGER=$(PACKAGER) -e UPDATE_VENDOR=$(UPDATE_VENDOR) -v $(CURDIR):/src -v $(CURDIR)/build:/out $(BIN_IMAGE) make build ARGS="$(ARGS)" 14 15 build-debug: .bin-image 16 docker run -t --rm -e PACKAGER=$(PACKAGER) -e UPDATE_VENDOR=$(UPDATE_VENDOR) -v $(CURDIR):/src -v $(CURDIR)/build:/out $(BIN_IMAGE) make build-debug ARGS="$(ARGS)" 17 18 test: .bin-image 19 docker run -t --rm -e PACKAGER=$(PACKAGER) -e UPDATE_VENDOR=$(UPDATE_VENDOR) -v $(CURDIR):/src --network="host" $(BIN_IMAGE) make test ARGS="$(ARGS)" 20 21 test-integration: .bin-image 22 docker run -t --rm -e PACKAGER=$(PACKAGER) -e UPDATE_VENDOR=$(UPDATE_VENDOR) -v $(CURDIR):/src --network="host" $(BIN_IMAGE) make test-integration ARGS="$(ARGS)" 23 24 test-all: .bin-image 25 docker run -t --rm -e PACKAGER=$(PACKAGER) -e UPDATE_VENDOR=$(UPDATE_VENDOR) -v $(CURDIR):/src --network="host" $(BIN_IMAGE) make test-all ARGS="$(ARGS)" 26 27 deb-backend-%: .deb-image 28 docker run -t --rm -e PACKAGER=$(PACKAGER) -e UPDATE_VENDOR=$(UPDATE_VENDOR) -v $(CURDIR):/src -v $(CURDIR)/build:/out $(DEB_IMAGE) /build/build-deb.sh backend $* $(ARGS) 29 30 deb-blockbook-%: .deb-image 31 docker run -t --rm -e PACKAGER=$(PACKAGER) -e UPDATE_VENDOR=$(UPDATE_VENDOR) -v $(CURDIR):/src -v $(CURDIR)/build:/out $(DEB_IMAGE) /build/build-deb.sh blockbook $* $(ARGS) 32 33 deb-%: .deb-image 34 docker run -t --rm -e PACKAGER=$(PACKAGER) -e UPDATE_VENDOR=$(UPDATE_VENDOR) -v $(CURDIR):/src -v $(CURDIR)/build:/out $(DEB_IMAGE) /build/build-deb.sh all $* $(ARGS) 35 36 deb-blockbook-all: clean-deb $(addprefix deb-blockbook-, $(TARGETS)) 37 38 $(addprefix all-, $(TARGETS)): all-%: clean-deb build-images deb-% 39 40 all: clean-deb build-images $(addprefix deb-, $(TARGETS)) 41 42 build-images: clean-images 43 $(MAKE) .bin-image .deb-image 44 45 .bin-image: 46 @if [ $$(build/tools/image_status.sh $(BIN_IMAGE):latest build/docker) != "ok" ]; then \ 47 echo "Building image $(BIN_IMAGE)..."; \ 48 docker build --no-cache=$(NO_CACHE) -t $(BIN_IMAGE) build/docker/bin; \ 49 else \ 50 echo "Image $(BIN_IMAGE) is up to date"; \ 51 fi 52 53 .deb-image: .bin-image 54 @if [ $$(build/tools/image_status.sh $(DEB_IMAGE):latest build/docker) != "ok" ]; then \ 55 echo "Building image $(DEB_IMAGE)..."; \ 56 docker build --no-cache=$(NO_CACHE) -t $(DEB_IMAGE) build/docker/deb; \ 57 else \ 58 echo "Image $(DEB_IMAGE) is up to date"; \ 59 fi 60 61 clean: clean-bin clean-deb 62 63 clean-all: clean clean-images 64 65 clean-bin: 66 find build -maxdepth 1 -type f -executable -delete 67 68 clean-deb: 69 rm -rf build/pkg-defs 70 rm -f build/*.deb 71 72 clean-images: clean-bin-image clean-deb-image 73 rm -f .bin-image .deb-image # remove obsolete tag files 74 75 clean-bin-image: 76 - docker rmi $(BIN_IMAGE) 77 78 clean-deb-image: 79 - docker rmi $(DEB_IMAGE)