Skip to content

Commit 2e48a3f

Browse files
committed
Merge branch 'tox-bootstrapd-smaller-docker' of https://github.com/nurupo/InsertProjectNameHere
2 parents c817b33 + c2b2142 commit 2e48a3f

File tree

1 file changed

+32
-33
lines changed

1 file changed

+32
-33
lines changed
Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
FROM debian:jessie
22

3-
# get all deps
4-
RUN apt-get update && apt-get install -y \
3+
WORKDIR /tmp/tox
4+
5+
RUN export BUILD_PACKAGES="\
56
build-essential \
67
libtool \
78
autotools-dev \
@@ -12,41 +13,40 @@ RUN apt-get update && apt-get install -y \
1213
yasm \
1314
libsodium-dev \
1415
libconfig-dev \
15-
python3 \
16-
&& apt-get clean \
17-
&& rm -rf /var/lib/apt/lists/*
18-
16+
python3" && \
17+
export RUNTIME_PACKAGES="\
18+
libconfig9 \
19+
libsodium13" && \
20+
# get all deps
21+
apt-get update && apt-get install -y $BUILD_PACKAGES $RUNTIME_PACKAGES && \
1922
# install toxcore and daemon
20-
WORKDIR /root/
21-
RUN git clone https://github.com/irungentoo/toxcore
22-
WORKDIR /root/toxcore/
23-
RUN ./autogen.sh
24-
RUN ./configure --enable-daemon
25-
RUN make -j`nproc`
26-
RUN make install -j`nproc`
27-
RUN ldconfig
28-
29-
WORKDIR /root/toxcore/other/bootstrap_daemon/
30-
23+
git clone https://github.com/irungentoo/toxcore && \
24+
cd toxcore && \
25+
./autogen.sh && \
26+
./configure --enable-daemon && \
27+
make -j`nproc` && \
28+
make install -j`nproc` && \
29+
ldconfig && \
3130
# add new user
32-
RUN useradd --home-dir /var/lib/tox-bootstrapd --create-home \
31+
useradd --home-dir /var/lib/tox-bootstrapd --create-home \
3332
--system --shell /sbin/nologin \
3433
--comment "Account to run Tox's DHT bootstrap daemon" \
35-
--user-group tox-bootstrapd
36-
RUN chmod 700 /var/lib/tox-bootstrapd
37-
38-
RUN cp tox-bootstrapd.conf /etc/tox-bootstrapd.conf
39-
34+
--user-group tox-bootstrapd && \
35+
chmod 700 /var/lib/tox-bootstrapd && \
36+
cp other/bootstrap_daemon/tox-bootstrapd.conf /etc/tox-bootstrapd.conf && \
4037
# remove all the example bootstrap nodes from the config file
41-
RUN N=-1 && \
42-
while grep -q "bootstrap_nodes =" /etc/tox-bootstrapd.conf; \
43-
do \
44-
head -n $N tox-bootstrapd.conf > /etc/tox-bootstrapd.conf; \
45-
N=$((N-1)); \
46-
done
47-
38+
sed -i '/^bootstrap_nodes = /,$d' /etc/tox-bootstrapd.conf && \
4839
# add bootstrap nodes from https://nodes.tox.chat/
49-
RUN python3 docker/get-nodes.py >> /etc/tox-bootstrapd.conf
40+
python3 other/bootstrap_daemon/docker/get-nodes.py >> /etc/tox-bootstrapd.conf && \
41+
# perform cleanup
42+
export AUTO_ADDED_PACKAGES="$(apt-mark showauto)" && \
43+
apt-get remove --purge -y $BUILD_PACKAGES $AUTO_ADDED_PACKAGES && \
44+
apt-get clean && \
45+
rm -rf /var/lib/apt/lists/* && \
46+
cd / && \
47+
rm -rf /tmp/*
48+
49+
WORKDIR /var/lib/tox-bootstrapd
5050

5151
USER tox-bootstrapd
5252

@@ -55,5 +55,4 @@ ENTRYPOINT /usr/local/bin/tox-bootstrapd \
5555
--log-backend stdout \
5656
--foreground
5757

58-
EXPOSE 443 3389 33445
59-
EXPOSE 33445/udp
58+
EXPOSE 443/tcp 3389/tcp 33445/tcp 33445/udp

0 commit comments

Comments
 (0)