mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-03 11:45:18 +00:00
Rework Docker image (#5087)
* fix #5086 * fixes #5082 - run tendermint init on runtime (if necessary) * Address some feedback: - restrict the entrypoint to only run `tendermint` - script into /usr/local/bin * make it also possible to run ``ith unmodified config again via: `docker run -v $HOME/.tendermint:/tendermint tendermint/tendermint init * Update DOCKER/docker-entrypoint.sh Co-authored-by: Greg Szabo <16846635+greg-szabo@users.noreply.github.com> Co-authored-by: Greg Szabo <16846635+greg-szabo@users.noreply.github.com>
This commit is contained in:
@@ -27,28 +27,21 @@ WORKDIR $TMHOME
|
||||
# p2p, rpc and prometheus port
|
||||
EXPOSE 26656 26657 26660
|
||||
|
||||
ENTRYPOINT ["/usr/bin/tendermint"]
|
||||
CMD ["node"]
|
||||
STOPSIGNAL SIGTERM
|
||||
|
||||
ARG BINARY=tendermint
|
||||
COPY $BINARY /usr/bin/tendermint
|
||||
|
||||
# Create default configuration for docker run.
|
||||
RUN /usr/bin/tendermint init && \
|
||||
sed -i \
|
||||
-e 's/^proxy_app\s*=.*/proxy_app = "kvstore"/' \
|
||||
-e 's/^moniker\s*=.*/moniker = "dockernode"/' \
|
||||
-e 's/^addr_book_strict\s*=.*/addr_book_strict = false/' \
|
||||
-e 's/^timeout_commit\s*=.*/timeout_commit = "500ms"/' \
|
||||
-e 's/^index_all_tags\s*=.*/index_all_tags = true/' \
|
||||
-e 's,^laddr = "tcp://127.0.0.1:26657",laddr = "tcp://0.0.0.0:26657",' \
|
||||
-e 's/^prometheus\s*=.*/prometheus = true/' \
|
||||
$TMHOME/config/config.toml && \
|
||||
sed -i \
|
||||
-e 's/^\s*"chain_id":.*/ "chain_id": "dockerchain",/' \
|
||||
$TMHOME/config/genesis.json
|
||||
# You can overwrite these before the first run to influence
|
||||
# config.json and genesis.json. Additionally, you can override
|
||||
# CMD to add parameters to `tendermint node`.
|
||||
ENV PROXY_APP=kvstore MONIKER=dockernode CHAIN_ID=dockerchain
|
||||
|
||||
COPY ./docker-entrypoint.sh /usr/local/bin/
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
CMD ["node"]
|
||||
|
||||
# Expose the data directory as a volume since there's mutable state in there
|
||||
VOLUME [ $TMHOME ]
|
||||
VOLUME [ "$TMHOME" ]
|
||||
|
||||
|
||||
21
DOCKER/docker-entrypoint.sh
Executable file
21
DOCKER/docker-entrypoint.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
if [ ! -d "$TMHOME/config" ]; then
|
||||
echo "Running tendermint init to create (default) configuration for docker run."
|
||||
tendermint init &&
|
||||
sed -i \
|
||||
-e "s/^proxy_app\s*=.*/proxy_app = \"$PROXY_APP\"/" \
|
||||
-e "s/^moniker\s*=.*/moniker = \"$MONIKER\"/" \
|
||||
-e 's/^addr_book_strict\s*=.*/addr_book_strict = false/' \
|
||||
-e 's/^timeout_commit\s*=.*/timeout_commit = "500ms"/' \
|
||||
-e 's/^index_all_tags\s*=.*/index_all_tags = true/' \
|
||||
-e 's,^laddr = "tcp://127.0.0.1:26657",laddr = "tcp://0.0.0.0:26657",' \
|
||||
-e 's/^prometheus\s*=.*/prometheus = true/' \
|
||||
"$TMHOME/config/config.toml" &&
|
||||
sed -i \
|
||||
-e "s/^\s*\"chain_id\":.*/ \"chain_id\": \"$CHAIN_ID\",/" \
|
||||
"$TMHOME/config/genesis.json"
|
||||
fi
|
||||
|
||||
exec tendermint "$@"
|
||||
Reference in New Issue
Block a user