Skip to content

Commit

Permalink
Dockerfile and Dockerfile.dev for development
Browse files Browse the repository at this point in the history
  • Loading branch information
melekes committed Mar 14, 2017
1 parent 6f83510 commit 0e730e6
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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}"]
12 changes: 12 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -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
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.PHONY: all test get_deps

all: test install

NOVENDOR = go list github.com/tendermint/basecoin/... | grep -v /vendor/
Expand All @@ -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

0 comments on commit 0e730e6

Please sign in to comment.