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.
 
 

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