2018-06-21 11:58:25 +02:00
|
|
|
# A container for PyBitmessage daemon
|
|
|
|
|
2018-07-16 10:55:55 +02:00
|
|
|
FROM ubuntu:xenial
|
|
|
|
|
|
|
|
RUN apt-get update
|
|
|
|
|
|
|
|
# Install dependencies
|
|
|
|
RUN apt-get install -yq --no-install-suggests --no-install-recommends \
|
|
|
|
python-msgpack dh-python python-all-dev build-essential libssl-dev \
|
|
|
|
python-stdeb fakeroot python-pip libcap-dev
|
|
|
|
|
|
|
|
RUN pip install --upgrade pip
|
|
|
|
|
2018-06-21 11:58:25 +02:00
|
|
|
EXPOSE 8444 8442
|
2018-07-16 10:55:55 +02:00
|
|
|
|
|
|
|
ENV HOME /home/bitmessage
|
|
|
|
ENV BITMESSAGE_HOME ${HOME}
|
|
|
|
|
|
|
|
ENV VER 0.6.3.2
|
|
|
|
|
|
|
|
WORKDIR ${HOME}
|
|
|
|
ADD . ${HOME}
|
|
|
|
|
|
|
|
# Install tests dependencies
|
|
|
|
RUN pip install -r requirements.txt
|
|
|
|
|
|
|
|
# Build and install deb
|
|
|
|
RUN python2 setup.py sdist \
|
|
|
|
&& py2dsc-deb dist/pybitmessage-${VER}.tar.gz \
|
|
|
|
&& dpkg -i deb_dist/python-pybitmessage_${VER}-1_amd64.deb
|
|
|
|
|
2019-02-06 16:19:09 +01:00
|
|
|
# Create a user
|
|
|
|
RUN useradd bitmessage && chown -R bitmessage ${HOME}
|
|
|
|
|
|
|
|
USER bitmessage
|
|
|
|
|
2018-07-16 10:55:55 +02:00
|
|
|
# Generate default config
|
2019-02-06 16:19:09 +01:00
|
|
|
RUN src/bitmessagemain.py -t && mv keys.dat /tmp
|
2018-07-16 10:55:55 +02:00
|
|
|
|
|
|
|
# Clean HOME
|
2019-02-06 16:19:09 +01:00
|
|
|
RUN rm -rf ${HOME}/*
|
2018-07-16 10:55:55 +02:00
|
|
|
|
|
|
|
# Setup environment
|
2019-02-06 16:19:09 +01:00
|
|
|
RUN mv /tmp/keys.dat . \
|
2018-07-16 10:55:55 +02:00
|
|
|
&& APIPASS=$(tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo) \
|
|
|
|
&& echo "\napiusername: api\napipassword: $APIPASS" \
|
|
|
|
&& echo "apienabled = true\napiinterface = 0.0.0.0\napiusername = api\napipassword = $APIPASS" >> keys.dat
|
|
|
|
|
2018-06-21 11:58:25 +02:00
|
|
|
CMD ["pybitmessage", "-d"]
|