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.
 
 

48 lines
3.5 KiB

  1. FROM debian:buster-slim
  2. ENV LC_ALL=C
  3. # Software installation
  4. RUN echo 'deb http://deb.debian.org/debian buster-backports main' >/etc/apt/sources.list.d/backports.list \
  5. && DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get -qqy --no-install-recommends -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold -o Dpkg::Options::=--force-unsafe-io update \
  6. && DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get -qqy --no-install-recommends -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold -o Dpkg::Options::=--force-unsafe-io install apt-utils \
  7. && DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get -qqy --no-install-recommends -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold -o Dpkg::Options::=--force-unsafe-io install gnupg ca-certificates \
  8. && echo 'deb https://apache.bintray.com/couchdb-deb buster main' >/etc/apt/sources.list.d/couchdb.list \
  9. && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8756C4F765C9AC3CB6B85D62379CE192D401AB61 \
  10. && DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get -qqy --no-install-recommends -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold -o Dpkg::Options::=--force-unsafe-io update \
  11. && DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get -qqy --no-install-recommends -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold -o Dpkg::Options::=--force-unsafe-io install build-essential ruby ruby-dev bundler python3 python3-websockets redis-server couchdb=2.3.1-1~buster git libzmq5 libzmq3-dev \
  12. && DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get -qqy --no-install-recommends -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold -o Dpkg::Options::=--force-unsafe-io -t buster-backports install zstd \
  13. && rm -rf /var/lib/apt/lists/*
  14. # Set up things under archivebot user and launch scripts
  15. RUN groupadd -r archivebot && useradd -r -m -g archivebot archivebot
  16. USER archivebot
  17. RUN git clone https://github.com/ArchiveTeam/ArchiveBot.git /home/archivebot/ArchiveBot \
  18. && cd /home/archivebot/ArchiveBot \
  19. && git checkout ed1feffa53a9dec2029ce8a14cd4d20e13673a61 \
  20. && rm Gemfile.lock \
  21. && sed -i "s|, '~> 3\.0\.2'||; s/gem 'webmachine', .*$/gem 'webmachine', '~> 1.2.2'/; s/gem 'reel'/gem 'reel', '~> 0.4.0'/" Gemfile \
  22. && GEM_HOME=/home/archivebot/.gems bundle install \
  23. && cd /home/archivebot/ArchiveBot/plumbing \
  24. && rm Gemfile.lock \
  25. && GEM_HOME=/home/archivebot/.gems bundle install \
  26. && mkdir -p /home/archivebot/redis/data/
  27. COPY --chown=root:root launch-root.sh /root/
  28. COPY --chown=archivebot:archivebot launch-archivebot.sh /home/archivebot/
  29. COPY --chown=archivebot:archivebot redis.conf /home/archivebot/redis/
  30. VOLUME /home/archivebot/redis/data/
  31. USER root
  32. # Set up CouchDB
  33. RUN /etc/init.d/couchdb start \
  34. && ( set +e; for i in $(seq 10); do curl -sf http://127.0.0.1:5984/ && exit 0 || sleep 1; done; echo 'CouchDB still not operational after 10 seconds'; exit 1; ) \
  35. && curl -sf -X PUT http://127.0.0.1:5984/_users \
  36. && curl -sf -X PUT http://127.0.0.1:5984/_replicator \
  37. && curl -sf -X PUT http://127.0.0.1:5984/archivebot \
  38. && grep -v _rev /home/archivebot/ArchiveBot/db/design_docs/ignore_patterns.json | curl -sf -X PUT --data @- http://127.0.0.1:5984/archivebot/_design/ignore_patterns \
  39. && grep -v _rev /home/archivebot/ArchiveBot/db/design_docs/user_agents.json | curl -sf -X PUT --data @- http://127.0.0.1:5984/archivebot/_design/user_agents
  40. EXPOSE 4567
  41. EXPOSE 4568
  42. ENTRYPOINT ["/root/launch-root.sh"]