diff --git a/Makefile b/Makefile index 160a53bbe..3b01636c1 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: statusgo all test xgo clean help +.PHONY: statusgo statusd-prune all test xgo clean help .PHONY: statusgo-android statusgo-ios help: ##@other Show this help @@ -25,6 +25,7 @@ gotest_extraflags = DOCKER_IMAGE_NAME ?= statusteam/status-go BOOTNODE_IMAGE_NAME ?= statusteam/bootnode +STATUSD_PRUNE_IMAGE_NAME ?= statusteam/statusd-prune DOCKER_TEST_WORKDIR = /go/src/github.com/status-im/status-go/ DOCKER_TEST_IMAGE = golang:1.10 @@ -57,6 +58,15 @@ statusgo: ##@build Build status-go as statusd server @echo "Compilation done." @echo "Run \"build/bin/statusd -h\" to view available commands." +statusd-prune: ##@statusd-prune Build statusd-prune + go build -o $(GOBIN)/statusd-prune -v ./cmd/statusd-prune + @echo "Compilation done." + @echo "Run \"build/bin/statusd-prune -h\" to view available commands." + +statusd-prune-docker-image: ##@statusd-prune Build statusd-prune docker image + @echo "Building docker image..." + docker build --file _assets/build/Dockerfile-prune . -t $(STATUSD_PRUNE_IMAGE_NAME):latest + bootnode: ##@build Build discovery v5 bootnode using status-go deps go build -i -o $(GOBIN)/bootnode -v -tags '$(BUILD_TAGS)' $(BUILD_FLAGS) ./cmd/bootnode/ @echo "Compilation done." diff --git a/_assets/build/Dockerfile-prune b/_assets/build/Dockerfile-prune new file mode 100644 index 000000000..d4e0fd009 --- /dev/null +++ b/_assets/build/Dockerfile-prune @@ -0,0 +1,17 @@ +# Build status-go in a Go builder container +FROM golang:1.10-alpine as builder + +RUN apk add --no-cache make gcc musl-dev linux-headers + +RUN mkdir -p /go/src/github.com/status-im/status-go +ADD . /go/src/github.com/status-im/status-go +RUN cd /go/src/github.com/status-im/status-go && make statusd-prune + +# Copy the binary to the second image +FROM alpine:latest + +RUN apk add --no-cache ca-certificates bash + +COPY --from=builder /go/src/github.com/status-im/status-go/build/bin/statusd-prune /usr/local/bin/ + +CMD ["statusd-prune"]