Update Dockerfile (#521)

This commit is contained in:
Adam Babik 2018-01-03 19:50:19 +01:00 committed by Ivan Daniluk
parent d4782a3f1e
commit da4c0d1db9
4 changed files with 35 additions and 19 deletions

View File

@ -1 +1,6 @@
* .git
.ethereumtest
.github
build/bin
statusd-data
wnode-data

View File

@ -1,15 +1,20 @@
FROM alpine:3.5 # Build wnode-status in a Go builder container
FROM golang:1.9-alpine as builder
RUN \ RUN apk add --no-cache make gcc musl-dev linux-headers
apk add --update go git make gcc musl-dev linux-headers ca-certificates && \
git clone --depth 1 --branch feature/statusd-replaces-geth-on-cluster https://github.com/farazdagi/status-go && \
(cd status-go && make) && \
cp status-go/build/bin/statusd /statusd && \
apk del go git make gcc musl-dev linux-headers && \
rm -rf /status-go && rm -rf /var/cache/apk/*
EXPOSE 8545 RUN mkdir -p /go/src/github.com/status-im/status-go
EXPOSE 30303 ADD . /go/src/github.com/status-im/status-go
EXPOSE 3001 RUN cd /go/src/github.com/status-im/status-go && make statusgo && make wnode-status
ENTRYPOINT ["/statusd"] # 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/* /usr/local/bin/
RUN mkdir -p /static/keys
COPY --from=builder /go/src/github.com/status-im/status-go/static/keys/* /static/keys/
# 30304 is used for Discovery v5
EXPOSE 8080 8545 30303 30303/udp 30304/udp

View File

@ -7,13 +7,18 @@ help: ##@other Show this help
include ./static/tools/mk/lint.mk include ./static/tools/mk/lint.mk
ifndef GOPATH ifndef GOPATH
$(error GOPATH not set. Please set GOPATH and make sure status-go is located at $$GOPATH/src/github.com/status-im/status-go. For more information about the GOPATH environment variable, see https://golang.org/doc/code.html#GOPATH) $(error GOPATH not set. Please set GOPATH and make sure status-go is located at $$GOPATH/src/github.com/status-im/status-go. \
For more information about the GOPATH environment variable, see https://golang.org/doc/code.html#GOPATH)
endif endif
CGO_CFLAGS=-I/$(JAVA_HOME)/include -I/$(JAVA_HOME)/include/darwin CGO_CFLAGS=-I/$(JAVA_HOME)/include -I/$(JAVA_HOME)/include/darwin
GOBIN = build/bin GOBIN = build/bin
GO ?= latest GO ?= latest
DOCKER_IMAGE_NAME ?= status-go
UNIT_TEST_PACKAGES := $(shell go list ./... | grep -v /vendor | grep -v /e2e | grep -v /cmd | grep -v /lib)
# This is a code for automatic help generator. # This is a code for automatic help generator.
# It supports ANSI colors and categories. # It supports ANSI colors and categories.
# To add new item into help output, simply add comments # To add new item into help output, simply add comments
@ -35,10 +40,6 @@ HELP_FUN = \
print "\n"; \ print "\n"; \
} }
# Main targets
UNIT_TEST_PACKAGES := $(shell go list ./... | grep -v /vendor | grep -v /e2e | grep -v /cmd | grep -v /lib)
statusgo: ##@build Build status-go as statusd server statusgo: ##@build Build status-go as statusd server
go build -i -o $(GOBIN)/statusd -v $(shell build/testnet-flags.sh) ./cmd/statusd go build -i -o $(GOBIN)/statusd -v $(shell build/testnet-flags.sh) ./cmd/statusd
@echo "\nCompilation done.\nRun \"build/bin/statusd -h\" to view available commands." @echo "\nCompilation done.\nRun \"build/bin/statusd -h\" to view available commands."
@ -69,6 +70,10 @@ statusgo-library: ##@cross-compile Build status-go as static library for current
@echo "Static library built:" @echo "Static library built:"
@ls -la $(GOBIN)/libstatus.* @ls -la $(GOBIN)/libstatus.*
docker-image: ##@docker Build docker image (use DOCKER_IMAGE_NAME to set the image name)
@echo "Building docker image..."
docker build . -t $(DOCKER_IMAGE_NAME)
xgo: xgo:
docker pull farazdagi/xgo docker pull farazdagi/xgo
go get github.com/karalabe/xgo go get github.com/karalabe/xgo

View File

@ -15,7 +15,7 @@ var (
prodMode = flag.Bool("production", false, "Whether production settings should be loaded") prodMode = flag.Bool("production", false, "Whether production settings should be loaded")
dataDir = flag.String("datadir", "wnode-data", "Data directory for the databases and keystore") dataDir = flag.String("datadir", "wnode-data", "Data directory for the databases and keystore")
networkID = flag.Int("networkid", params.RopstenNetworkID, "Network identifier (integer, 1=Homestead, 3=Ropsten, 4=Rinkeby)") networkID = flag.Int("networkid", params.RopstenNetworkID, "Network identifier (integer, 1=Homestead, 3=Ropsten, 4=Rinkeby)")
listenAddr = flag.String("listenaddr", params.ListenAddr, "IP address and port of this node (e.g. 127.0.0.1:30303)") listenAddr = flag.String("listenaddr", ":30303", "IP address and port of this node (e.g. 127.0.0.1:30303)")
httpEnabled = flag.Bool("http", false, "HTTP RPC enpoint enabled (default: false)") httpEnabled = flag.Bool("http", false, "HTTP RPC enpoint enabled (default: false)")
httpPort = flag.Int("httpport", params.HTTPPort, "HTTP RPC server's listening port") httpPort = flag.Int("httpport", params.HTTPPort, "HTTP RPC server's listening port")
ipcEnabled = flag.Bool("ipc", false, "IPC RPC endpoint enabled") ipcEnabled = flag.Bool("ipc", false, "IPC RPC endpoint enabled")
@ -107,6 +107,7 @@ func makeNodeConfig() (*params.NodeConfig, error) {
if !*httpEnabled { if !*httpEnabled {
nodeConfig.HTTPHost = "" // HTTP RPC is disabled nodeConfig.HTTPHost = "" // HTTP RPC is disabled
} }
nodeConfig.HTTPHost = "0.0.0.0"
nodeConfig.HTTPPort = *httpPort nodeConfig.HTTPPort = *httpPort
nodeConfig.IPCEnabled = *ipcEnabled nodeConfig.IPCEnabled = *ipcEnabled
nodeConfig.RPCEnabled = *httpEnabled nodeConfig.RPCEnabled = *httpEnabled