forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ethanfrey/dockerize simapp (cosmos#6495)
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |