diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000000..79b078d91caa --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM alpine:3.5 + +# BCHOME is where your genesis.json, key.json and other files including state are stored. +ENV BCHOME /basecoin + +# Create a basecoin user and group first so the IDs get set the same way, even +# as the rest of this may change over time. +RUN addgroup basecoin && \ + adduser -S -G basecoin basecoin + +RUN mkdir -p $BCHOME && \ + chown -R basecoin:basecoin $BCHOME +WORKDIR $BCHOME + +# Expose the basecoin home directory as a volume since there's mutable state in there. +VOLUME $BCHOME + +# jq and curl used for extracting `pub_key` from private validator while +# deploying tendermint with Kubernetes. It is nice to have bash so the users +# could execute bash commands. +RUN apk add --no-cache bash curl jq + +COPY basecoin /usr/bin/basecoin + +ENTRYPOINT ["basecoin"] + +# By default you will get the basecoin with local MerkleEyes and in-proc Tendermint. +CMD ["start", "--dir=${BCHOME}"] diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 000000000000..ee6cdc6e2165 --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,12 @@ +FROM golang:latest + +RUN mkdir -p /go/src/github.com/tendermint/basecoin +WORKDIR /go/src/github.com/tendermint/basecoin + +COPY Makefile /go/src/github.com/tendermint/basecoin/ +COPY glide.yaml /go/src/github.com/tendermint/basecoin/ +COPY glide.lock /go/src/github.com/tendermint/basecoin/ + +RUN make get_vendor_deps + +COPY . /go/src/github.com/tendermint/basecoin diff --git a/Makefile b/Makefile index 89f9af72b554..32ec678624cd 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,3 @@ -.PHONY: all test get_deps - all: test install NOVENDOR = go list github.com/tendermint/basecoin/... | grep -v /vendor/ @@ -24,3 +22,11 @@ get_vendor_deps: go get github.com/Masterminds/glide glide install +build-docker: + docker run -it --rm -v "$(PWD):/go/src/github.com/tendermint/basecoin" -w "/go/src/github.com/tendermint/basecoin" -e "CGO_ENABLED=0" golang:alpine go build ./cmd/basecoin + docker build -t "tendermint/basecoin" . + +clean: + @rm -f ./basecoin + +.PHONY: all build install test get_deps update_deps get_vendor_deps build-docker clean