Ethanfrey/dockerize simapp (#6495)

This commit is contained in:
Ethan Frey 2020-06-24 14:15:08 +02:00 committed by GitHub
parent 06d7dbedb9
commit ab18c3fae0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 46 additions and 0 deletions

46
Dockerfile Normal file
View File

@ -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"]