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.
 
 

79 lines
2.4 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. RUN find . -type f
  11. FROM python:3.6-stretch
  12. RUN apt-get update && apt-get dist-upgrade -y && apt-get install -y \
  13. build-essential \
  14. libxml2-dev libxslt-dev zlib1g-dev libssl-dev libsqlite3-dev \
  15. libffi-dev git tmux fontconfig-config fonts-dejavu-core curl \
  16. libfontconfig1 libjpeg62-turbo-dev libjpeg62-turbo libjpeg-dev libjpeg-turbo-progs lsof ffmpeg \
  17. autossh rsync bundler git tmux python3 libtool pkg-config \
  18. build-essential autoconf automake libzmq3-dev libmnl0 \
  19. && rm -rf /var/lib/apt/lists/*
  20. # Install tcp-closer
  21. COPY --from=builder /tcp_closer/src/build/tcp-closer-0.1.1-Linux.deb /tcp-closer.deb
  22. RUN dpkg -i /tcp-closer.deb
  23. # Add user
  24. RUN groupadd -g 1337 ab
  25. RUN groupadd -r psudo
  26. RUN useradd -rm -d /home/ab -s /bin/bash -g ab -G psudo -u 1337 ab
  27. # Install python dependencies
  28. RUN pip install websockets requests
  29. RUN curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
  30. # Setup output directory
  31. RUN mkdir /data
  32. RUN chown ab:ab /data
  33. RUN chmod a+rx /usr/local/bin/youtube-dl
  34. # Install tini
  35. ENV TINI_VERSION v0.19.0
  36. ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
  37. RUN chmod +x /tini
  38. # Give ab sudo for a bit
  39. RUN echo "%psudo ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/psudo
  40. RUN chmod 0440 /etc/sudoers.d/psudo
  41. USER ab
  42. # Clone the repo
  43. RUN git clone --recursive https://github.com/ArchiveTeam/ArchiveBot.git /home/ab/ArchiveBot
  44. WORKDIR /home/ab/ArchiveBot
  45. # Setup symlinks for pipeline
  46. RUN ln -s /usr/local/bin/wpull /home/ab/ArchiveBot/pipeline/wpull
  47. RUN rm /home/ab/ArchiveBot/pipeline/youtube-dl
  48. RUN ln -s /usr/local/bin/youtube-dl /home/ab/ArchiveBot/pipeline/youtube-dl
  49. # Setup env var
  50. ENV OPENSSL_CONF=/home/ab/ArchiveBot/ops/openssl-less-secure.cnf
  51. # Bundle install
  52. RUN bundle install
  53. RUN cd plumbing && bundle install && cd ..
  54. # Install pip dependencies
  55. USER root
  56. RUN pip install -r pipeline/requirements.txt
  57. # Copy in entrypoint
  58. COPY entrypoint.sh /entrypoint.sh
  59. # Button up image
  60. USER ab
  61. ENTRYPOINT [ "/tini", "--", "/entrypoint.sh" ]