add Dockerfile and Makefile tasks to build statusd-prune docker image (#1005)

* add Dockerfile and Makefile tasks to build statusd-prune docker image

* add image ENTRYPOINT

* set default CMD to statusd-prune
This commit is contained in:
Andrea Franz 2018-06-07 12:30:18 +02:00 committed by GitHub
parent cfa5e2b6e3
commit 5d0120ee28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 1 deletions

View File

@ -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 .PHONY: statusgo-android statusgo-ios
help: ##@other Show this help help: ##@other Show this help
@ -25,6 +25,7 @@ gotest_extraflags =
DOCKER_IMAGE_NAME ?= statusteam/status-go DOCKER_IMAGE_NAME ?= statusteam/status-go
BOOTNODE_IMAGE_NAME ?= statusteam/bootnode 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_WORKDIR = /go/src/github.com/status-im/status-go/
DOCKER_TEST_IMAGE = golang:1.10 DOCKER_TEST_IMAGE = golang:1.10
@ -57,6 +58,15 @@ statusgo: ##@build Build status-go as statusd server
@echo "Compilation done." @echo "Compilation done."
@echo "Run \"build/bin/statusd -h\" to view available commands." @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 bootnode: ##@build Build discovery v5 bootnode using status-go deps
go build -i -o $(GOBIN)/bootnode -v -tags '$(BUILD_TAGS)' $(BUILD_FLAGS) ./cmd/bootnode/ go build -i -o $(GOBIN)/bootnode -v -tags '$(BUILD_TAGS)' $(BUILD_FLAGS) ./cmd/bootnode/
@echo "Compilation done." @echo "Compilation done."

View File

@ -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"]