You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

90 lines
2.9 KiB

  1. FROM debian:stretch as builder
  2. RUN apt-get update && apt-get dist-upgrade -y && apt-get install -y \
  3. build-essential dpkg-dev devscripts cmake git libmnl-dev \
  4. && rm -rf /var/lib/apt/lists/*
  5. RUN git clone https://github.com/kristrev/tcp_closer.git /tcp_closer
  6. RUN mkdir -p tcp_closer/src/build
  7. WORKDIR /tcp_closer/src/build
  8. RUN cmake ..
  9. RUN make package
  10. FROM python:3.6.14-stretch
  11. RUN apt-get update && apt-get dist-upgrade -y && apt-get install -y \
  12. build-essential \
  13. libxml2-dev libxslt-dev zlib1g-dev libssl-dev libsqlite3-dev \
  14. libffi-dev git tmux fontconfig-config fonts-dejavu-core curl sqlite3 sqlite sqlite3-pcre \
  15. libfontconfig1 libjpeg62-turbo-dev libjpeg62-turbo libjpeg-dev libjpeg-turbo-progs lsof ffmpeg \
  16. autossh rsync bundler git tmux python3 libtool pkg-config gdb python3-dbg \
  17. build-essential autoconf automake libzmq3-dev libmnl0 make \
  18. && rm -rf /var/lib/apt/lists/*
  19. # GDB support for Python commands (e.g. py-bt)
  20. RUN mkdir -p /usr/share/gdb/auto-load/usr/local/bin/ && \
  21. curl -L https://github.com/python/cpython/raw/v3.6.14/Tools/gdb/libpython.py -o /usr/share/gdb/auto-load/usr/local/bin/python3.6-gdb.py
  22. # Install tcp-closer
  23. COPY --from=builder /tcp_closer/src/build/tcp-closer-0.1.1-Linux.deb /tcp-closer.deb
  24. RUN dpkg -i /tcp-closer.deb
  25. # Add user
  26. RUN groupadd -g 1337 ab
  27. RUN groupadd -r psudo
  28. RUN useradd -rm -d /home/ab -s /bin/bash -g ab -G psudo -u 1337 ab
  29. # Install python dependencies
  30. RUN pip install websockets requests
  31. RUN curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
  32. # Setup output directory
  33. RUN mkdir -p /data
  34. RUN mkdir -p /local-staging
  35. RUN chown ab:ab /data
  36. RUN chown ab:ab /local-staging
  37. RUN chmod a+rx /usr/local/bin/youtube-dl
  38. # Install tini
  39. ENV TINI_VERSION v0.19.0
  40. ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
  41. RUN chmod +x /tini
  42. # Give ab sudo for a bit
  43. RUN echo "%psudo ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/psudo
  44. RUN chmod 0440 /etc/sudoers.d/psudo
  45. USER ab
  46. # Clone the repo
  47. RUN git clone --recursive https://github.com/ArchiveTeam/ArchiveBot.git /home/ab/ArchiveBot
  48. # Clone JAA's little-things repo as per his request
  49. RUN git clone --recursive https://gitea.arpa.li/JustAnotherArchivist/little-things.git /home/ab/little-things
  50. WORKDIR /home/ab/ArchiveBot
  51. # Setup symlinks for pipeline
  52. RUN ln -s /usr/local/bin/wpull /home/ab/ArchiveBot/pipeline/wpull
  53. RUN rm /home/ab/ArchiveBot/pipeline/youtube-dl
  54. RUN ln -s /usr/local/bin/youtube-dl /home/ab/ArchiveBot/pipeline/youtube-dl
  55. # Setup env var
  56. ENV OPENSSL_CONF=/home/ab/ArchiveBot/ops/openssl-less-secure.cnf
  57. # Bundle install
  58. RUN bundle install
  59. RUN cd plumbing && bundle install && cd ..
  60. # Install pip dependencies
  61. USER root
  62. RUN pip install -r pipeline/requirements.txt
  63. # Copy in entrypoint
  64. COPY entrypoint.sh /entrypoint.sh
  65. COPY stager.sh /stager.sh
  66. COPY wait-empty.sh /wait-empty.sh
  67. # Button up image
  68. USER ab
  69. ENTRYPOINT [ "/tini", "--", "/entrypoint.sh" ]