Dockerfile 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. FROM ubuntu:20.04 AS base
  2. RUN apt-get update \
  3. && apt-get upgrade -y \
  4. && DEBIAN_FRONTEND=noninteractive apt-get install -y \
  5. wget \
  6. build-essential \
  7. automake \
  8. autoconf \
  9. libtool \
  10. python3 \
  11. python3-numpy \
  12. zlib1g \
  13. zlib1g-dev \
  14. tmux \
  15. vim \
  16. dstat \
  17. htop
  18. RUN mkdir ~/code \
  19. ~/code/releases \
  20. ~/code/dev \
  21. ~/code/working \
  22. ~/build
  23. RUN cd /tmp \
  24. && wget --no-verbose https://github.com/openssl/openssl/archive/OpenSSL_1_1_1h.tar.gz \
  25. && echo "d1f723c1f6b6d1eaf26655caa50d2f60d4d33f4b04977b1da63def878f386fcc OpenSSL_1_1_1h.tar.gz" | sha256sum -c - \
  26. && tar -xzf OpenSSL_*.tar.gz \
  27. && rm OpenSSL_*.tar.gz \
  28. && mv openssl-OpenSSL_* ~/code/releases
  29. RUN cd ~/code/releases/openssl-OpenSSL_* \
  30. && ./config --shared --prefix="$HOME/build" \
  31. && make \
  32. && make install \
  33. && [ -f "$HOME/build/lib/libssl.so" ] && echo "OK" || echo "Not installed properly"
  34. RUN cd /tmp \
  35. && wget --no-verbose https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz \
  36. && echo "92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb libevent-2.1.12-stable.tar.gz" | sha256sum -c - \
  37. && tar -xzf libevent-2.1.12-stable.tar.gz \
  38. && rm libevent-2.1.12-stable.tar.gz \
  39. && mv libevent-*-stable ~/code/releases
  40. RUN cd ~/code/releases/libevent-*-stable \
  41. && ./configure --prefix="$HOME/build" --disable-openssl \
  42. && make "-j$(nproc)" \
  43. && make install
  44. RUN cd /tmp \
  45. && wget --no-verbose https://github.com/gperftools/gperftools/archive/gperftools-2.7.tar.gz \
  46. && echo "3a88b4544315d550c87db5c96775496243fb91aa2cea88d2b845f65823f3d38a gperftools-2.7.tar.gz" | sha256sum -c - \
  47. && tar -xzf gperftools-*.tar.gz \
  48. && rm gperftools-*.tar.gz \
  49. && mv gperftools-gperftools-* ~/code/releases
  50. RUN cd ~/code/releases/gperftools-gperftools-* \
  51. && ./autogen.sh \
  52. && ./configure --prefix="$HOME/build" \
  53. && make "-j$(nproc)" \
  54. && make install
  55. RUN cd /tmp \
  56. && wget --no-verbose https://github.com/jemalloc/jemalloc/archive/5.2.1.tar.gz \
  57. && mv 5.2.1.tar.gz jemalloc-5.2.1.tar.gz \
  58. && echo "ed51b0b37098af4ca6ed31c22324635263f8ad6471889e0592a9c0dba9136aea jemalloc-5.2.1.tar.gz" | sha256sum -c - \
  59. && tar -xzf jemalloc-*.tar.gz \
  60. && rm jemalloc-*.tar.gz \
  61. && mv jemalloc-5.2.1 ~/code/releases
  62. RUN cd ~/code/releases/jemalloc-* \
  63. && ./autogen.sh \
  64. && ./configure --prefix="$HOME/build" \
  65. && make "-j$(nproc)" \
  66. && make install
  67. RUN cd /tmp \
  68. && wget --no-verbose https://archive.torproject.org/tor-package-archive/tor-0.4.2.6.tar.gz \
  69. && echo "0500102433849bbe3231c590973d126c2d2d6b3943b4b9f9962bdb108436e6c4 tor-0.4.2.6.tar.gz" | sha256sum -c - \
  70. && tar -xzf tor-0.4.2.6.tar.gz \
  71. && rm tor-0.4.2.6.tar.gz \
  72. && mv tor-0.4.2.6 ~/code/releases/tor-0.4.2.6
  73. RUN cd ~/code/releases/tor-0.4.2.6 \
  74. && ./configure --disable-asciidoc --with-libevent-dir="$HOME/build" --with-openssl-dir="$HOME/build" \
  75. && LD_RUN_PATH="$HOME/build/lib" make "-j$(nproc)" \
  76. && ldd src/app/tor
  77. COPY tor /root/code/working/tor
  78. RUN cd ~/code/working/tor \
  79. && ./autogen.sh \
  80. && ./configure --disable-asciidoc --disable-unittests --with-libevent-dir="$HOME/build" --with-openssl-dir="$HOME/build" \
  81. && LD_RUN_PATH="$HOME/build/lib" make "-j$(nproc)" \
  82. && ldd src/app/tor
  83. ########################
  84. FROM base AS benchmarker
  85. RUN apt-get update \
  86. && apt-get upgrade -y \
  87. && DEBIAN_FRONTEND=noninteractive apt-get install -y \
  88. openssh-server
  89. COPY sshkey.pub /tmp/sshkey.pub
  90. RUN sed -i 's/#\?Port 22/Port 2222/g' /etc/ssh/sshd_config \
  91. && mkdir ~/.ssh \
  92. && chmod 700 ~/.ssh \
  93. && cat /tmp/sshkey.pub >> ~/.ssh/authorized_keys \
  94. && chmod 600 ~/.ssh/authorized_keys \
  95. && rm /tmp/sshkey.pub
  96. RUN cd /tmp \
  97. && wget --no-verbose https://archive.torproject.org/tor-package-archive/tor-0.4.2.6.tar.gz \
  98. && echo "0500102433849bbe3231c590973d126c2d2d6b3943b4b9f9962bdb108436e6c4 tor-0.4.2.6.tar.gz" | sha256sum -c - \
  99. && tar -xzf tor-0.4.2.6.tar.gz \
  100. && rm tor-0.4.2.6.tar.gz \
  101. && mv tor-0.4.2.6 ~/code/dev/tor-0.4.2.6-throughput-log
  102. COPY src/throughput-logging.patch /tmp
  103. RUN cd ~/code/dev/tor-0.4.2.6-throughput-log \
  104. && patch -p1 < /tmp/throughput-logging.patch \
  105. && rm /tmp/throughput-logging.patch \
  106. && ./configure --disable-asciidoc --with-libevent-dir="$HOME/build" --with-openssl-dir="$HOME/build" \
  107. && LD_RUN_PATH="$HOME/build/lib" make "-j$(nproc)" \
  108. && ldd src/app/tor
  109. ########################
  110. FROM base as controller
  111. RUN apt-get update \
  112. && apt-get upgrade -y \
  113. && DEBIAN_FRONTEND=noninteractive apt-get install -y \
  114. git \
  115. python3-dev \
  116. python3-pip \
  117. openssh-client
  118. COPY sshkey /root/.ssh/id_rsa
  119. RUN printf "\nHost *\n Port 2222\n StrictHostKeyChecking no\n" >> ~/.ssh/config
  120. RUN cd ~/code/dev \
  121. && git clone https://git.torproject.org/stem.git \
  122. && cd stem \
  123. && git checkout '1.8.0' \
  124. && pip3 install --user .
  125. COPY chutney /root/code/working/chutney
  126. RUN printf 'export CHUTNEY_DATA_DIR="/tmp/chutney-net"\n' >> ~/.bashrc
  127. RUN cd /tmp \
  128. && wget --no-verbose https://archive.torproject.org/tor-package-archive/tor-0.4.2.6.tar.gz \
  129. && echo "0500102433849bbe3231c590973d126c2d2d6b3943b4b9f9962bdb108436e6c4 tor-0.4.2.6.tar.gz" | sha256sum -c - \
  130. && tar -xzf tor-0.4.2.6.tar.gz \
  131. && rm tor-0.4.2.6.tar.gz \
  132. && mv tor-0.4.2.6 ~/code/dev/tor-0.4.2.6-fixed-controller
  133. COPY src/fixed-controller.patch /tmp
  134. RUN cd ~/code/dev/tor-0.4.2.6-fixed-controller \
  135. && patch -p1 < /tmp/fixed-controller.patch \
  136. && rm /tmp/fixed-controller.patch \
  137. && ./configure --disable-asciidoc --with-libevent-dir="$HOME/build" --with-openssl-dir="$HOME/build" \
  138. && LD_RUN_PATH="$HOME/build/lib" make "-j$(nproc)" \
  139. && ldd src/app/tor
  140. COPY . /root/code/working/tor-benchmarking
  141. RUN cd ~/code/working/tor-benchmarking \
  142. && make