Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 

83 linhas
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. 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. # Patch a file
  46. COPY config.patch /home/ab/config.patch
  47. RUN patch /home/ab/ArchiveBot/pipeline/archivebot/shared_config.py /home/ab/config.patch
  48. # Setup symlinks for pipeline
  49. RUN ln -s /usr/local/bin/wpull /home/ab/ArchiveBot/pipeline/wpull
  50. RUN rm /home/ab/ArchiveBot/pipeline/youtube-dl
  51. RUN ln -s /usr/local/bin/youtube-dl /home/ab/ArchiveBot/pipeline/youtube-dl
  52. # Setup env var
  53. ENV OPENSSL_CONF=/home/ab/ArchiveBot/ops/openssl-less-secure.cnf
  54. # Bundle install
  55. RUN bundle install
  56. RUN cd plumbing && bundle install && cd ..
  57. # Install pip dependencies
  58. USER root
  59. RUN pip install -r pipeline/requirements.txt
  60. # Copy in entrypoint
  61. COPY entrypoint.sh /entrypoint.sh
  62. # Button up image
  63. USER ab
  64. ENTRYPOINT [ "/tini", "--", "/entrypoint.sh" ]