25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

86 lines
2.7 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 make \
  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. # Clone JAA's little-things repo as per his request
  46. RUN git clone --recursive https://gitea.arpa.li/JustAnotherArchivist/little-things.git /home/ab/little-things
  47. WORKDIR /home/ab/ArchiveBot
  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. COPY stager.sh /stager.sh
  63. COPY wait-empty.sh /wait-empty.sh
  64. # Button up image
  65. USER ab
  66. ENTRYPOINT [ "/tini", "--", "/entrypoint.sh" ]