Merge remote-tracking branch 'anton/improvement/dockerfile' into unstable
This commit is contained in:
commit
82828524fe
|
@ -1,54 +1,44 @@
|
||||||
# Pull base image.
|
FROM golang:1.7.4
|
||||||
FROM golang:1.6
|
|
||||||
|
|
||||||
ENV USER tmuser
|
# This is the release of tendermint to pull in.
|
||||||
ENV DATA_ROOT /data/tendermint
|
ENV TM_VERSION 0.8.0
|
||||||
|
|
||||||
|
# Tendermint will be looking for genesis file in /tendermint (unless you change
|
||||||
|
# `genesis_file` in config.toml). You can put your config.toml and private
|
||||||
|
# validator file into /tendermint.
|
||||||
|
#
|
||||||
|
# The /tendermint/data dir is used by tendermint to store state.
|
||||||
|
ENV DATA_ROOT /tendermint
|
||||||
|
ENV TMROOT $DATA_ROOT
|
||||||
|
|
||||||
# Set user right away for determinism
|
# Set user right away for determinism
|
||||||
RUN groupadd -r $USER \
|
RUN groupadd -r tmuser && \
|
||||||
&& useradd -r -s /bin/false -g $USER $USER
|
useradd -r -s /bin/false -g tmuser tmuser
|
||||||
|
|
||||||
# Create home directory for USER
|
|
||||||
# Needed for nodejs/nom
|
|
||||||
RUN mkdir -p /home/$USER \
|
|
||||||
&& chown -R $USER:$USER /home/$USER
|
|
||||||
|
|
||||||
# Create directory for persistence and give our user ownership
|
# Create directory for persistence and give our user ownership
|
||||||
RUN mkdir -p $DATA_ROOT \
|
RUN mkdir -p $DATA_ROOT && \
|
||||||
&& chown -R $USER:$USER $DATA_ROOT
|
chown -R tmuser:tmuser $DATA_ROOT
|
||||||
|
|
||||||
# Set the env variables to non-interactive
|
# TODO replace with downloading a binary (this will allow us to replace golang
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
# base container with alpine|jessie - 600MB vs 50MB)
|
||||||
ENV DEBIAN_PRIORITY critical
|
|
||||||
ENV DEBCONF_NOWARNINGS yes
|
|
||||||
ENV TERM linux
|
|
||||||
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
|
|
||||||
|
|
||||||
# Grab deps (git)
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
git && \
|
git && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
RUN mkdir -p $GOPATH/src/github.com/tendermint/tendermint && \
|
||||||
|
cd $GOPATH/src/github.com/tendermint/tendermint && \
|
||||||
|
git clone https://github.com/tendermint/tendermint.git . && \
|
||||||
|
git fetch && \
|
||||||
|
git reset --hard v$TM_VERSION && \
|
||||||
|
make install
|
||||||
|
|
||||||
# Grab deps (node)
|
# Expose the data directory as a volume since there's mutable state in there
|
||||||
RUN curl -sL https://deb.nodesource.com/setup_5.x | bash -
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y --no-install-recommends \
|
|
||||||
nodejs && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Copy run.sh
|
|
||||||
COPY ./run.sh $DATA_ROOT/run.sh
|
|
||||||
RUN chmod +x $DATA_ROOT/run.sh
|
|
||||||
|
|
||||||
# Persist data, set user
|
|
||||||
WORKDIR $DATA_ROOT
|
|
||||||
VOLUME $DATA_ROOT
|
VOLUME $DATA_ROOT
|
||||||
USER $USER
|
|
||||||
ENV TMROOT $DATA_ROOT
|
|
||||||
|
|
||||||
EXPOSE 46656
|
EXPOSE 46656
|
||||||
EXPOSE 46657
|
EXPOSE 46657
|
||||||
|
|
||||||
# Run tendermint
|
ENTRYPOINT ["tendermint"]
|
||||||
CMD ["./run.sh"]
|
|
||||||
|
# By default you'll get the dummy app
|
||||||
|
CMD ["node", "--moniker=`hostname`", "--proxy_app=dummy"]
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
#! /bin/bash
|
|
||||||
|
|
||||||
mkdir -p $GOPATH/src/$TMREPO
|
|
||||||
cd $GOPATH/src/$TMREPO
|
|
||||||
git clone https://$TMREPO.git .
|
|
||||||
git fetch
|
|
||||||
git reset --hard $TMHEAD
|
|
||||||
go get -d $TMREPO/cmd/tendermint
|
|
||||||
make
|
|
||||||
tendermint node --seeds="$TMSEEDS" --moniker="$TMNAME"
|
|
Loading…
Reference in New Issue