diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..34ae16ec2 --- /dev/null +++ b/Dockerfile @@ -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"]