2020-08-14 02:23:27 +00:00
|
|
|
# This is the Dockerfile for ArchiveBox, it bundles the following dependencies:
|
|
|
|
# python3, ArchiveBox, curl, wget, git, chromium, youtube-dl, single-file
|
2019-02-28 19:04:37 +00:00
|
|
|
# Usage:
|
2020-08-14 02:23:27 +00:00
|
|
|
# docker build . -t archivebox --no-cache
|
2020-07-22 05:30:58 +00:00
|
|
|
# docker run -v "$PWD/data":/data archivebox init
|
|
|
|
# docker run -v "$PWD/data":/data archivebox add 'https://example.com'
|
2020-08-14 02:23:27 +00:00
|
|
|
# docker run -v "$PWD/data":/data -it archivebox manage createsuperuser
|
|
|
|
# docker run -v "$PWD/data":/data -p 8000:8000 archivebox server
|
2019-02-28 19:04:37 +00:00
|
|
|
|
2020-06-25 21:46:11 +00:00
|
|
|
FROM python:3.8-slim-buster
|
2019-07-09 17:05:51 +00:00
|
|
|
|
2020-06-25 21:46:11 +00:00
|
|
|
LABEL name="archivebox" \
|
2020-08-14 02:23:27 +00:00
|
|
|
maintainer="Nick Sweeting <archivebox-docker@sweeting.me>" \
|
|
|
|
description="All-in-one personal internet archiving container" \
|
|
|
|
homepage="https://github.com/pirate/ArchiveBox" \
|
|
|
|
documentation="https://github.com/pirate/ArchiveBox/wiki/Docker#docker"
|
2018-10-14 02:47:30 +00:00
|
|
|
|
2020-08-14 02:23:27 +00:00
|
|
|
# System-level base config
|
2020-06-26 01:30:29 +00:00
|
|
|
ENV TZ=UTC \
|
2020-06-25 21:46:11 +00:00
|
|
|
LANGUAGE=en_US:en \
|
|
|
|
LC_ALL=C.UTF-8 \
|
2020-06-26 01:30:29 +00:00
|
|
|
LANG=C.UTF-8 \
|
2020-06-25 21:46:11 +00:00
|
|
|
PYTHONIOENCODING=UTF-8 \
|
|
|
|
PYTHONUNBUFFERED=1 \
|
2020-08-14 02:23:27 +00:00
|
|
|
DEBIAN_FRONTEND=noninteractive \
|
|
|
|
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1
|
|
|
|
|
|
|
|
# Application-level base config
|
|
|
|
ENV CODE_DIR=/app \
|
2020-06-25 21:46:11 +00:00
|
|
|
VENV_PATH=/venv \
|
2020-08-14 02:23:27 +00:00
|
|
|
DATA_DIR=/data \
|
|
|
|
NODE_DIR=/node \
|
|
|
|
ARCHIVEBOX_USER="archivebox"
|
2018-10-14 02:47:30 +00:00
|
|
|
|
2020-08-14 02:23:27 +00:00
|
|
|
# Create non-privileged user for archivebox and chrome
|
|
|
|
RUN groupadd --system $ARCHIVEBOX_USER \
|
|
|
|
&& useradd --system --create-home --gid $ARCHIVEBOX_USER --groups audio,video $ARCHIVEBOX_USER
|
|
|
|
|
|
|
|
# Install system dependencies
|
|
|
|
RUN apt-get update -qq \
|
2020-06-25 21:46:11 +00:00
|
|
|
&& apt-get install -qq -y --no-install-recommends \
|
2020-08-14 02:23:27 +00:00
|
|
|
apt-transport-https ca-certificates apt-utils gnupg gnupg2 libgconf-2-4 zlib1g-dev \
|
|
|
|
dumb-init gosu unzip curl \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
# Install Python environment
|
|
|
|
RUN apt-get update -qq \
|
|
|
|
&& apt-get install -qq -y --no-install-recommends \
|
|
|
|
ipython3 python-dev python3-dev \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
# Install Node environment
|
|
|
|
RUN curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
|
|
|
|
&& echo 'deb https://deb.nodesource.com/node_14.x buster main' >> /etc/apt/sources.list \
|
2020-06-26 01:30:29 +00:00
|
|
|
&& apt-get update -qq \
|
2020-06-25 21:46:11 +00:00
|
|
|
&& apt-get install -qq -y --no-install-recommends \
|
2020-08-14 02:23:27 +00:00
|
|
|
nodejs \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
# Install apt dependencies
|
|
|
|
RUN apt-get update -qq \
|
|
|
|
&& apt-get install -qq -y --no-install-recommends \
|
|
|
|
wget curl chromium git ffmpeg youtube-dl \
|
|
|
|
fontconfig fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-symbola fonts-noto fonts-freefont-ttf \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
# Install Python dependencies
|
|
|
|
WORKDIR "$CODE_DIR"
|
2020-07-28 04:53:50 +00:00
|
|
|
ENV PATH="${PATH}:$VENV_PATH/bin"
|
2020-06-26 01:30:29 +00:00
|
|
|
RUN python -m venv --clear --symlinks "$VENV_PATH" \
|
2020-08-14 02:23:27 +00:00
|
|
|
&& pip install --upgrade --quiet pip setuptools
|
|
|
|
ADD ./archivebox.egg-info/requires.txt "$CODE_DIR/archivebox.egg-info/requires.txt"
|
2020-08-14 03:35:31 +00:00
|
|
|
RUN apt-get update -qq \
|
|
|
|
&& apt-get install -qq -y --no-install-recommends \
|
|
|
|
build-essential \
|
|
|
|
&& grep -B 1000 -E '^$' "$CODE_DIR/archivebox.egg-info/requires.txt" | pip install --quiet -r /dev/stdin \
|
|
|
|
&& apt-get purge -y build-essential \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2018-10-14 02:47:30 +00:00
|
|
|
|
2020-08-14 02:23:27 +00:00
|
|
|
# Install Node dependencies
|
|
|
|
WORKDIR "$NODE_DIR"
|
|
|
|
ENV PATH="${PATH}:$NODE_DIR/node_modules/.bin" \
|
|
|
|
npm_config_loglevel=error
|
|
|
|
RUN npm install -g npm
|
|
|
|
ADD ./package.json ./package.json
|
|
|
|
RUN npm install
|
|
|
|
|
|
|
|
# Install ArchiveBox Python package
|
|
|
|
WORKDIR "$CODE_DIR"
|
|
|
|
ADD . "$CODE_DIR"
|
|
|
|
RUN pip install -e .
|
|
|
|
|
|
|
|
# Setup ArchiveBox runtime config
|
|
|
|
WORKDIR "$DATA_DIR"
|
2020-08-10 18:15:53 +00:00
|
|
|
ENV IN_DOCKER=True \
|
2020-08-04 16:50:01 +00:00
|
|
|
CHROME_SANDBOX=False \
|
2020-08-14 02:23:27 +00:00
|
|
|
CHROME_BINARY="chromium" \
|
|
|
|
SINGLEFILE_BINARY="$NODE_DIR/node_modules/.bin/single-file" \
|
|
|
|
READABILITY_BINARY="$NODE_DIR/node_modules/.bin/readability-extractor"
|
|
|
|
|
|
|
|
# Print version for nice docker finish summary
|
|
|
|
RUN archivebox version
|
2018-10-14 02:47:30 +00:00
|
|
|
|
2020-08-14 02:23:27 +00:00
|
|
|
# Open up the interfaces to the outside world
|
|
|
|
VOLUME "$DATA_DIR"
|
|
|
|
VOLUME "$CODE_DIR"
|
|
|
|
EXPOSE 8000
|
2020-07-22 05:30:58 +00:00
|
|
|
|
2020-08-10 18:15:53 +00:00
|
|
|
ENTRYPOINT ["dumb-init", "--", "/app/bin/docker_entrypoint.sh"]
|
|
|
|
CMD ["archivebox", "server", "0.0.0.0:8000"]
|