Skip to content

Commit

Permalink
Ethanfrey/dockerize simapp (cosmos#6495)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanfrey authored Jun 24, 2020
1 parent 06d7dbe commit ab18c3f
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Simple usage with a mounted data directory:
# > docker build -t simapp .
#
# Server:
# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.simapp:/root/.simapp simapp simd init test-chain
# TODO: need to set validator in genesis so start runs
# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.simapp:/root/.simapp simapp simd start
#
# Client: (Note the simapp binary always looks at ~/.simapp we can bind to different local storage)
# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.simappcli:/root/.simapp simapp simcli keys add foo
# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.simappcli:/root/.simapp simapp simcli keys list
# TODO: demo connecting rest-server (or is this in server now?)
FROM golang:alpine AS build-env

# Install minimum necessary dependencies,
ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev python3
RUN apk add --no-cache $PACKAGES

# Set working directory for the build
WORKDIR /go/src/github.com/cosmos/cosmos-sdk

# Add source files
COPY . .

# build Cosmos SDK, remove packages
RUN make tools && \
make build-sim && \
cp ./build/sim* /go/bin
# make build-sim-linux ??


# Final image
FROM alpine:edge

# Install ca-certificates
RUN apk add --update ca-certificates
WORKDIR /root

# Copy over binaries from the build-env
COPY --from=build-env /go/bin/simd /usr/bin/simd
COPY --from=build-env /go/bin/simcli /usr/bin/simcli

EXPOSE 26656 26657 1317

# Run simd by default, omit entrypoint to ease using container with simcli
CMD ["simd"]

0 comments on commit ab18c3f

Please sign in to comment.