2019-10-28 17:33:41 +08:00
|
|
|
FROM debian:buster-slim
|
2016-01-02 06:18:37 +08:00
|
|
|
|
2016-01-27 23:11:45 +08:00
|
|
|
WORKDIR /tmp/tox
|
|
|
|
|
|
|
|
RUN export BUILD_PACKAGES="\
|
2016-01-02 06:18:37 +08:00
|
|
|
build-essential \
|
2018-09-27 11:34:27 +08:00
|
|
|
cmake \
|
2016-01-02 06:18:37 +08:00
|
|
|
git \
|
2016-02-07 06:51:41 +08:00
|
|
|
libconfig-dev \
|
2018-09-27 11:34:27 +08:00
|
|
|
libsodium-dev \
|
2016-01-27 23:11:45 +08:00
|
|
|
python3" && \
|
|
|
|
export RUNTIME_PACKAGES="\
|
2016-02-07 06:51:41 +08:00
|
|
|
libconfig9 \
|
2019-10-28 17:33:41 +08:00
|
|
|
libsodium23" && \
|
2016-01-27 23:11:45 +08:00
|
|
|
# get all deps
|
|
|
|
apt-get update && apt-get install -y $BUILD_PACKAGES $RUNTIME_PACKAGES && \
|
2016-01-02 06:18:37 +08:00
|
|
|
# install toxcore and daemon
|
2017-12-13 10:31:38 +08:00
|
|
|
git clone https://github.com/TokTok/c-toxcore && \
|
|
|
|
cd c-toxcore && \
|
2018-09-27 06:59:13 +08:00
|
|
|
# checkout latest release version
|
2018-09-27 11:34:27 +08:00
|
|
|
git checkout $(git tag --list | grep -P '^v(\d+).(\d+).(\d+)$' | \
|
|
|
|
sed "s/v/v /g" | sed "s/\./ /g" | \
|
|
|
|
sort -snk4,4 | sort -snk3,3 | sort -snk2,2 | tail -n 1 | \
|
|
|
|
sed 's/v /v/g' | sed 's/ /\./g') && \
|
|
|
|
mkdir _build && \
|
|
|
|
cd _build && \
|
|
|
|
cmake .. \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-DENABLE_SHARED=ON \
|
|
|
|
-DENABLE_STATIC=OFF \
|
|
|
|
-DBUILD_TOXAV=OFF \
|
|
|
|
-DBOOTSTRAP_DAEMON=ON && \
|
2016-01-27 23:11:45 +08:00
|
|
|
make -j`nproc` && \
|
|
|
|
make install -j`nproc` && \
|
2018-09-27 11:34:27 +08:00
|
|
|
cd .. && \
|
2016-01-02 06:18:37 +08:00
|
|
|
# add new user
|
2016-01-27 23:11:45 +08:00
|
|
|
useradd --home-dir /var/lib/tox-bootstrapd --create-home \
|
2016-01-02 06:18:37 +08:00
|
|
|
--system --shell /sbin/nologin \
|
|
|
|
--comment "Account to run Tox's DHT bootstrap daemon" \
|
2016-01-27 23:11:45 +08:00
|
|
|
--user-group tox-bootstrapd && \
|
|
|
|
chmod 700 /var/lib/tox-bootstrapd && \
|
|
|
|
cp other/bootstrap_daemon/tox-bootstrapd.conf /etc/tox-bootstrapd.conf && \
|
2016-01-02 06:18:37 +08:00
|
|
|
# remove all the example bootstrap nodes from the config file
|
2016-02-07 06:51:41 +08:00
|
|
|
sed -i '/^bootstrap_nodes = /,$d' /etc/tox-bootstrapd.conf && \
|
2016-01-02 06:18:37 +08:00
|
|
|
# add bootstrap nodes from https://nodes.tox.chat/
|
2016-01-27 23:11:45 +08:00
|
|
|
python3 other/bootstrap_daemon/docker/get-nodes.py >> /etc/tox-bootstrapd.conf && \
|
2016-02-07 06:51:41 +08:00
|
|
|
# perform cleanup
|
2017-12-13 10:31:38 +08:00
|
|
|
apt-get remove --purge -y $BUILD_PACKAGES && \
|
2016-01-27 23:11:45 +08:00
|
|
|
apt-get clean && \
|
2017-12-13 10:31:38 +08:00
|
|
|
apt-get autoremove -y && \
|
2016-01-27 23:11:45 +08:00
|
|
|
rm -rf /var/lib/apt/lists/* && \
|
|
|
|
cd / && \
|
|
|
|
rm -rf /tmp/*
|
|
|
|
|
2016-02-07 06:51:41 +08:00
|
|
|
WORKDIR /var/lib/tox-bootstrapd
|
2016-01-02 06:18:37 +08:00
|
|
|
|
|
|
|
USER tox-bootstrapd
|
|
|
|
|
|
|
|
ENTRYPOINT /usr/local/bin/tox-bootstrapd \
|
|
|
|
--config /etc/tox-bootstrapd.conf \
|
|
|
|
--log-backend stdout \
|
|
|
|
--foreground
|
|
|
|
|
2016-02-07 06:51:41 +08:00
|
|
|
EXPOSE 443/tcp 3389/tcp 33445/tcp 33445/udp
|