From 739975dc3d7cf2eafa4573e682e51528e7599285 Mon Sep 17 00:00:00 2001 From: romik-g Date: Wed, 27 Jan 2016 16:11:45 +0100 Subject: [PATCH 1/2] Re-format to reduce image file by 50% --- other/bootstrap_daemon/docker/Dockerfile | 60 +++++++++++++----------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/other/bootstrap_daemon/docker/Dockerfile b/other/bootstrap_daemon/docker/Dockerfile index ef9d525c..bfa8f1e1 100644 --- a/other/bootstrap_daemon/docker/Dockerfile +++ b/other/bootstrap_daemon/docker/Dockerfile @@ -1,7 +1,8 @@ FROM debian:jessie -# get all deps -RUN apt-get update && apt-get install -y \ +WORKDIR /tmp/tox + +RUN export BUILD_PACKAGES="\ build-essential \ libtool \ autotools-dev \ @@ -11,42 +12,45 @@ RUN apt-get update && apt-get install -y \ git \ yasm \ libsodium-dev \ + python3" && \ + export RUNTIME_PACKAGES="\ libconfig-dev \ - python3 \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* - + libsodium13" && \ +# get all deps + apt-get update && apt-get install -y $BUILD_PACKAGES $RUNTIME_PACKAGES && \ # install toxcore and daemon -WORKDIR /root/ -RUN git clone https://github.com/irungentoo/toxcore -WORKDIR /root/toxcore/ -RUN ./autogen.sh -RUN ./configure --enable-daemon -RUN make -j`nproc` -RUN make install -j`nproc` -RUN ldconfig - -WORKDIR /root/toxcore/other/bootstrap_daemon/ - + git clone https://github.com/irungentoo/toxcore && \ + cd toxcore && \ + ./autogen.sh && \ + ./configure --enable-daemon && \ + make -j`nproc` && \ + make install -j`nproc` && \ + ldconfig && \ # add new user -RUN useradd --home-dir /var/lib/tox-bootstrapd --create-home \ + useradd --home-dir /var/lib/tox-bootstrapd --create-home \ --system --shell /sbin/nologin \ --comment "Account to run Tox's DHT bootstrap daemon" \ - --user-group tox-bootstrapd -RUN chmod 700 /var/lib/tox-bootstrapd - -RUN cp tox-bootstrapd.conf /etc/tox-bootstrapd.conf - + --user-group tox-bootstrapd && \ + chmod 700 /var/lib/tox-bootstrapd && \ + cp other/bootstrap_daemon/tox-bootstrapd.conf /etc/tox-bootstrapd.conf && \ # remove all the example bootstrap nodes from the config file -RUN N=-1 && \ + N=-1 && \ while grep -q "bootstrap_nodes =" /etc/tox-bootstrapd.conf; \ do \ - head -n $N tox-bootstrapd.conf > /etc/tox-bootstrapd.conf; \ + head -n $N other/bootstrap_daemon/tox-bootstrapd.conf > /etc/tox-bootstrapd.conf; \ N=$((N-1)); \ - done - + done && \ # add bootstrap nodes from https://nodes.tox.chat/ -RUN python3 docker/get-nodes.py >> /etc/tox-bootstrapd.conf + python3 other/bootstrap_daemon/docker/get-nodes.py >> /etc/tox-bootstrapd.conf && \ + export AUTO_ADDED_PACKAGES="$(apt-mark showauto)" && \ + apt-get remove --purge -y $BUILD_PACKAGES $AUTO_ADDED_PACKAGES && \ + apt-get install -y $RUNTIME_PACKAGES && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* && \ + cd / && \ + rm -rf /tmp/* + +WORKDIR / USER tox-bootstrapd From c2b2142f336640e35c27fd5fdbe8348ddcff16b5 Mon Sep 17 00:00:00 2001 From: romik-g Date: Sat, 6 Feb 2016 23:51:41 +0100 Subject: [PATCH 2/2] Changes from @nurupo for build and runtime dependencies that reduce image size Also removal of example bootstrap nodes from the config file in one line --- other/bootstrap_daemon/docker/Dockerfile | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/other/bootstrap_daemon/docker/Dockerfile b/other/bootstrap_daemon/docker/Dockerfile index bfa8f1e1..d4d611b5 100644 --- a/other/bootstrap_daemon/docker/Dockerfile +++ b/other/bootstrap_daemon/docker/Dockerfile @@ -12,9 +12,10 @@ RUN export BUILD_PACKAGES="\ git \ yasm \ libsodium-dev \ + libconfig-dev \ python3" && \ export RUNTIME_PACKAGES="\ - libconfig-dev \ + libconfig9 \ libsodium13" && \ # get all deps apt-get update && apt-get install -y $BUILD_PACKAGES $RUNTIME_PACKAGES && \ @@ -34,23 +35,18 @@ RUN export BUILD_PACKAGES="\ chmod 700 /var/lib/tox-bootstrapd && \ cp other/bootstrap_daemon/tox-bootstrapd.conf /etc/tox-bootstrapd.conf && \ # remove all the example bootstrap nodes from the config file - N=-1 && \ - while grep -q "bootstrap_nodes =" /etc/tox-bootstrapd.conf; \ - do \ - head -n $N other/bootstrap_daemon/tox-bootstrapd.conf > /etc/tox-bootstrapd.conf; \ - N=$((N-1)); \ - done && \ + sed -i '/^bootstrap_nodes = /,$d' /etc/tox-bootstrapd.conf && \ # add bootstrap nodes from https://nodes.tox.chat/ python3 other/bootstrap_daemon/docker/get-nodes.py >> /etc/tox-bootstrapd.conf && \ +# perform cleanup export AUTO_ADDED_PACKAGES="$(apt-mark showauto)" && \ apt-get remove --purge -y $BUILD_PACKAGES $AUTO_ADDED_PACKAGES && \ - apt-get install -y $RUNTIME_PACKAGES && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* && \ cd / && \ rm -rf /tmp/* -WORKDIR / +WORKDIR /var/lib/tox-bootstrapd USER tox-bootstrapd @@ -59,5 +55,4 @@ ENTRYPOINT /usr/local/bin/tox-bootstrapd \ --log-backend stdout \ --foreground -EXPOSE 443 3389 33445 -EXPOSE 33445/udp +EXPOSE 443/tcp 3389/tcp 33445/tcp 33445/udp