github.com/cosmos/cosmos-sdk@v0.50.10/Dockerfile (about) 1 # Simple usage with a mounted data directory: 2 # > docker build -t simapp . 3 # 4 # Server: 5 # > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.simapp:/root/.simapp simapp simd init test-chain 6 # TODO: need to set validator in genesis so start runs 7 # > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.simapp:/root/.simapp simapp simd start 8 # 9 # Client: (Note the simapp binary always looks at ~/.simapp we can bind to different local storage) 10 # > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.simappcli:/root/.simapp simapp simd keys add foo 11 # > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.simappcli:/root/.simapp simapp simd keys list 12 # 13 # This image is pushed to the GHCR as https://ghcr.io/cosmos/simapp 14 15 FROM golang:1.21-alpine AS build-env 16 17 # Install minimum necessary dependencies 18 ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev 19 RUN apk add --no-cache $PACKAGES 20 21 # Set working directory for the build 22 WORKDIR /go/src/github.com/cosmos/cosmos-sdk 23 24 # optimization: if go.sum didn't change, docker will use cached image 25 COPY go.mod go.sum ./ 26 COPY collections/go.mod collections/go.sum ./collections/ 27 COPY store/go.mod store/go.sum ./store/ 28 COPY log/go.mod log/go.sum ./log/ 29 30 RUN go mod download 31 32 # Add source files 33 COPY . . 34 35 # Dockerfile Cross-Compilation Guide 36 # https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide 37 ARG TARGETOS TARGETARCH 38 39 # install simapp, remove packages 40 RUN GOOS=$TARGETOS GOARCH=$TARGETARCH make build 41 42 # Use alpine:3 as a base image 43 FROM alpine:3 44 45 EXPOSE 26656 26657 1317 9090 46 # Run simd by default, omit entrypoint to ease using container with simcli 47 CMD ["simd"] 48 STOPSIGNAL SIGTERM 49 WORKDIR /root 50 51 # Install minimum necessary dependencies 52 RUN apk add --no-cache curl make bash jq sed 53 54 # Copy over binaries from the build-env 55 COPY --from=build-env /go/src/github.com/cosmos/cosmos-sdk/build/simd /usr/bin/simd