Skip to content

Commit 22372bf

Browse files
committed
Add basic Dockerfile to build all binaries and export gaiad
1 parent e588ebf commit 22372bf

File tree

2 files changed

+36
-20
lines changed

2 files changed

+36
-20
lines changed

.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Dockerfile
2+
Vagrantfile
3+
4+
build/
5+
coverage.txt

Dockerfile

+31-20
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,39 @@
1-
FROM alpine:3.5
1+
# Simple usage with a mounted data directory:
2+
# > docker build -t gaia .
3+
# > docker run -v $HOME/.gaiad:/root/.gaiad gaia init
4+
# > docker run -v $HOME/.gaiad:/root/.gaiad gaia start
25

3-
# BCHOME is where your genesis.json, key.json and other files including state are stored.
4-
ENV BCHOME /basecoin
6+
FROM alpine:edge
57

6-
# Create a basecoin user and group first so the IDs get set the same way, even
7-
# as the rest of this may change over time.
8-
RUN addgroup basecoin && \
9-
adduser -S -G basecoin basecoin
8+
# Install minimum necessary dependencies
109

11-
RUN mkdir -p $BCHOME && \
12-
chown -R basecoin:basecoin $BCHOME
13-
WORKDIR $BCHOME
10+
ENV PACKAGES go glide make git libc-dev bash
11+
RUN apk add --no-cache $PACKAGES
1412

15-
# Expose the basecoin home directory as a volume since there's mutable state in there.
16-
VOLUME $BCHOME
13+
# Set up GOPATH & PATH
1714

18-
# jq and curl used for extracting `pub_key` from private validator while
19-
# deploying tendermint with Kubernetes. It is nice to have bash so the users
20-
# could execute bash commands.
21-
RUN apk add --no-cache bash curl jq
15+
ENV GOPATH /root/go
16+
ENV BASE_PATH $GOPATH/src/github.com/cosmos
17+
ENV REPO_PATH $BASE_PATH/cosmos-sdk
18+
ENV WORKDIR /cosmos/
19+
ENV PATH $GOPATH/bin:$PATH
2220

23-
COPY basecoin /usr/bin/basecoin
21+
# Link expected Go repo path
2422

25-
ENTRYPOINT ["basecoin"]
23+
RUN mkdir -p $WORKDIR $GOPATH/pkg $ $GOPATH/bin $BASE_PATH && ln -sf $WORKDIR $REPO_PATH
2624

27-
# By default you will get the basecoin with local MerkleEyes and in-proc Tendermint.
28-
CMD ["start", "--dir=${BCHOME}"]
25+
# Add source files
26+
27+
ADD . $WORKDIR
28+
29+
# Build cosmos-sdk
30+
31+
RUN cd $REPO_PATH && make get_tools && make get_vendor_deps && make all && make install
32+
33+
# Remove packages
34+
35+
RUN apk del $PACKAGES
36+
37+
# Set entrypoint
38+
39+
ENTRYPOINT ["/root/go/bin/gaiad"]

0 commit comments

Comments
 (0)