github.com/KYVENetwork/cometbft/v34@v34.0.3/DOCKER/Dockerfile (about) 1 # Use a build arg to ensure that both stages use the same, 2 # hopefully current, go version. 3 ARG GOLANG_BASE_IMAGE=golang:1.21-alpine 4 5 # stage 1 Generate CometBFT Binary 6 FROM --platform=$BUILDPLATFORM $GOLANG_BASE_IMAGE as builder 7 RUN apk update && \ 8 apk upgrade && \ 9 apk --no-cache add make git 10 COPY / /cometbft 11 WORKDIR /cometbft 12 13 RUN TARGETPLATFORM=$TARGETPLATFORM make build-linux 14 15 # stage 2 16 FROM $GOLANG_BASE_IMAGE 17 LABEL maintainer="hello@informal.systems" 18 19 # CometBFT will be looking for the genesis file in /cometbft/config/genesis.json 20 # (unless you change `genesis_file` in config.toml). You can put your config.toml and 21 # private validator file into /cometbft/config. 22 # 23 # The /cometbft/data dir is used by CometBFT to store state. 24 ENV CMTHOME /cometbft 25 26 # OS environment setup 27 # Set user right away for determinism, create directory for persistence and give our user ownership 28 # jq and curl used for extracting `pub_key` from private validator while 29 # deploying CometBFT with Kubernetes. It is nice to have bash so the users 30 # could execute bash commands. 31 RUN apk update && \ 32 apk upgrade && \ 33 apk --no-cache add curl jq bash && \ 34 addgroup tmuser && \ 35 adduser -S -G tmuser tmuser -h "$CMTHOME" 36 37 # Run the container with tmuser by default. (UID=100, GID=1000) 38 USER tmuser 39 40 WORKDIR $CMTHOME 41 42 # p2p, rpc and prometheus port 43 EXPOSE 26656 26657 26660 44 45 STOPSIGNAL SIGTERM 46 47 COPY --from=builder /cometbft/build/cometbft /usr/bin/cometbft 48 49 # You can overwrite these before the first run to influence 50 # config.json and genesis.json. Additionally, you can override 51 # CMD to add parameters to `cometbft node`. 52 ENV PROXY_APP=kvstore MONIKER=dockernode CHAIN_ID=dockerchain 53 54 COPY ./DOCKER/docker-entrypoint.sh /usr/local/bin/ 55 56 ENTRYPOINT ["docker-entrypoint.sh"] 57 CMD ["node"] 58 59 # Expose the data directory as a volume since there's mutable state in there 60 VOLUME [ "$CMTHOME" ] 61