2020-08-14 02:23:27 +00:00
# This is the Dockerfile for ArchiveBox, it bundles the following dependencies:
2022-09-12 20:34:02 +00:00
# python3, ArchiveBox, curl, wget, git, chromium, youtube-dl, yt-dlp, single-file
2019-02-28 19:04:37 +00:00
# Usage:
2022-09-11 20:11:13 +00:00
# git submodule update --init --recursive
# git pull --recurse-submodules
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
2022-04-21 14:29:27 +00:00
# Multi-arch build:
# docker buildx create --use
2024-10-04 07:16:03 +00:00
# docker buildx build . --platform=linux/amd64,linux/arm64--push -t archivebox/archivebox:0.7.5 -t archivebox/archivebox:dev
2022-09-11 20:13:22 +00:00
#
2023-10-20 12:10:03 +00:00
# Read more about [developing Archivebox](https://github.com/ArchiveBox/ArchiveBox#archivebox-development).
2022-04-21 14:29:27 +00:00
2024-10-04 07:08:44 +00:00
#########################################################################################
2019-02-28 19:04:37 +00:00
2023-10-31 10:19:35 +00:00
# Use Debian 12 w/ faster package updates: https://packages.debian.org/bookworm-backports/
2024-10-05 10:57:25 +00:00
FROM python:3.11-slim-bookworm
2024-10-08 08:47:38 +00:00
# FROM debian:bookworm-backports
2019-07-09 17:05:51 +00:00
2020-06-25 21:46:11 +00:00
LABEL name = "archivebox" \
2023-10-20 09:47:34 +00:00
maintainer = "Nick Sweeting <dockerfile@archivebox.io>" \
2024-04-12 21:16:55 +00:00
description = "All-in-one self-hosted internet archiving solution" \
2020-11-23 07:04:39 +00:00
homepage = "https://github.com/ArchiveBox/ArchiveBox" \
2024-04-12 21:16:55 +00:00
documentation = "https://github.com/ArchiveBox/ArchiveBox/wiki/Docker" \
org.opencontainers.image.title= "ArchiveBox" \
org.opencontainers.image.vendor= "ArchiveBox" \
org.opencontainers.image.description= "All-in-one self-hosted internet archiving solution" \
org.opencontainers.image.source= "https://github.com/ArchiveBox/ArchiveBox" \
com.docker.image.source.entrypoint= "Dockerfile" \
# TODO: release ArchiveBox as a Docker Desktop extension (requires these labels):
# https://docs.docker.com/desktop/extensions-sdk/architecture/metadata/
com.docker.desktop.extension.api.version= ">= 1.4.7" \
com.docker.desktop.extension.icon= "https://archivebox.io/icon.png" \
com.docker.extension.publisher-url= "https://archivebox.io" \
com.docker.extension.screenshots= '[{"alt": "Screenshot of Admin UI", "url": "https://github.com/ArchiveBox/ArchiveBox/assets/511499/e8e0b6f8-8fdf-4b7f-8124-c10d8699bdb2"}]' \
com.docker.extension.detailed-description= 'See here for detailed documentation: https://wiki.archivebox.io' \
com.docker.extension.changelog= 'See here for release notes: https://github.com/ArchiveBox/ArchiveBox/releases' \
com.docker.extension.categories= 'database,utility-tools'
2024-04-26 04:35:09 +00:00
2023-10-31 06:25:51 +00:00
ARG TARGETPLATFORM
2023-11-01 02:43:01 +00:00
ARG TARGETOS
2023-10-31 06:25:51 +00:00
ARG TARGETARCH
ARG TARGETVARIANT
######### Environment Variables #################################
2023-10-20 09:47:34 +00:00
# Global system-level 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-08-14 02:23:27 +00:00
DEBIAN_FRONTEND = noninteractive \
2023-10-20 09:47:34 +00:00
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE = 1 \
2023-10-31 06:25:51 +00:00
PYTHONIOENCODING = UTF-8 \
PYTHONUNBUFFERED = 1 \
2023-10-31 12:31:19 +00:00
PIP_DISABLE_PIP_VERSION_CHECK = 1 \
2023-10-20 09:47:34 +00:00
npm_config_loglevel = error
2018-10-14 02:47:30 +00:00
2023-10-31 06:25:51 +00:00
# Version config
2024-10-05 10:57:25 +00:00
ENV PYTHON_VERSION = 3 .11 \
2024-10-04 07:45:13 +00:00
NODE_VERSION = 22
2023-10-31 06:25:51 +00:00
# User config
ENV ARCHIVEBOX_USER = "archivebox" \
DEFAULT_PUID = 911 \
2024-10-08 08:47:38 +00:00
DEFAULT_PGID = 911 \
IN_DOCKER = True
2023-10-31 06:25:51 +00:00
# Global paths
2020-08-14 02:23:27 +00:00
ENV CODE_DIR = /app \
DATA_DIR = /data \
2023-10-31 06:25:51 +00:00
PLAYWRIGHT_BROWSERS_PATH = /browsers
2024-10-09 02:46:12 +00:00
# GLOBAL_VENV=/venv \
2024-10-04 01:24:27 +00:00
# TODO: add TMP_DIR and LIB_DIR?
2020-08-03 18:19:47 +00:00
2023-10-31 06:25:51 +00:00
# Build shell config
2023-10-31 10:06:02 +00:00
SHELL [ "/bin/bash" , "-o" , "pipefail" , "-o" , "errexit" , "-o" , "errtrace" , "-o" , "nounset" , "-c" ]
2023-10-31 06:25:51 +00:00
######### System Environment ####################################
2023-10-20 09:47:34 +00:00
2024-10-05 10:51:47 +00:00
# Detect ArchiveBox version number by reading pyproject.toml
COPY --chown= root:root --chmod= 755 pyproject.toml " $CODE_DIR / "
RUN grep '^version = ' " ${ CODE_DIR } /pyproject.toml " | awk -F'"' '{print $2}' > /VERSION.txt
2023-11-01 02:43:01 +00:00
# Force apt to leave downloaded binaries in /var/cache/apt (massively speeds up Docker builds)
2024-04-26 04:35:09 +00:00
RUN echo 'Binary::apt::APT::Keep-Downloaded-Packages "1";' > /etc/apt/apt.conf.d/99keep-cache \
&& echo 'APT::Install-Recommends "0";' > /etc/apt/apt.conf.d/99no-intall-recommends \
&& echo 'APT::Install-Suggests "0";' > /etc/apt/apt.conf.d/99no-intall-suggests \
2023-12-18 05:02:42 +00:00
&& rm -f /etc/apt/apt.conf.d/docker-clean
2023-10-31 13:28:11 +00:00
2023-11-04 04:54:17 +00:00
# Print debug info about build and save it to disk, for human eyes only, not used by anything else
2023-10-31 06:25:51 +00:00
RUN ( echo " [i] Docker build for ArchiveBox $( cat /VERSION.txt) starting... " \
&& echo " PLATFORM= ${ TARGETPLATFORM } ARCH= $( uname -m) ( $( uname -s) ${ TARGETARCH } ${ TARGETVARIANT } ) " \
&& echo " BUILD_START_TIME= $( date +"%Y-%m-%d %H:%M:%S %s" ) TZ= ${ TZ } LANG= ${ LANG } " \
&& echo \
&& echo " PYTHON= ${ PYTHON_VERSION } NODE= ${ NODE_VERSION } PATH= ${ PATH } " \
&& echo " CODE_DIR= ${ CODE_DIR } DATA_DIR= ${ DATA_DIR } " \
&& echo \
&& uname -a \
&& cat /etc/os-release | head -n7 \
&& which bash && bash --version | head -n1 \
&& which dpkg && dpkg --version | head -n1 \
&& echo -e '\n\n' && env && echo -e '\n\n' \
) | tee -a /VERSION.txt
2023-10-20 09:47:34 +00:00
2020-08-14 02:23:27 +00:00
# Create non-privileged user for archivebox and chrome
2023-10-31 10:06:02 +00:00
RUN echo " [*] Setting up $ARCHIVEBOX_USER user uid= ${ DEFAULT_PUID } ... " \
2023-10-20 11:08:38 +00:00
&& groupadd --system $ARCHIVEBOX_USER \
2023-10-20 09:47:34 +00:00
&& useradd --system --create-home --gid $ARCHIVEBOX_USER --groups audio,video $ARCHIVEBOX_USER \
2023-10-31 06:25:51 +00:00
&& usermod -u " $DEFAULT_PUID " " $ARCHIVEBOX_USER " \
&& groupmod -g " $DEFAULT_PGID " " $ARCHIVEBOX_USER " \
&& echo -e " \nARCHIVEBOX_USER= $ARCHIVEBOX_USER PUID= $( id -u $ARCHIVEBOX_USER ) PGID= $( id -g $ARCHIVEBOX_USER ) \n\n " \
| tee -a /VERSION.txt
# DEFAULT_PUID and DEFAULT_PID are overriden by PUID and PGID in /bin/docker_entrypoint.sh at runtime
# https://docs.linuxserver.io/general/understanding-puid-and-pgid
2020-08-03 18:19:47 +00:00
2023-10-20 09:47:34 +00:00
# Install system apt dependencies (adding backports to access more recent apt updates)
2023-11-01 02:43:41 +00:00
RUN --mount= type = cache,target= /var/cache/apt,sharing= locked,id= apt-$TARGETARCH $TARGETVARIANT \
2023-10-31 10:58:24 +00:00
echo " [+] Installing APT base system dependencies for $TARGETPLATFORM ... " \
2024-04-26 04:35:09 +00:00
&& echo 'deb https://deb.debian.org/debian bookworm-backports main contrib non-free' > /etc/apt/sources.list.d/backports.list \
2023-10-31 06:25:51 +00:00
&& mkdir -p /etc/apt/keyrings \
2023-10-20 09:47:34 +00:00
&& apt-get update -qq \
2024-04-26 04:35:09 +00:00
&& apt-get install -qq -y -t bookworm-backports \
2023-10-20 09:47:34 +00:00
# 1. packaging dependencies
2023-10-31 13:28:11 +00:00
apt-transport-https ca-certificates apt-utils gnupg2 curl wget \
2023-10-20 09:47:34 +00:00
# 2. docker and init system dependencies
2024-10-03 10:53:50 +00:00
zlib1g-dev dumb-init gosu cron unzip grep dnsutils \
2023-10-20 09:47:34 +00:00
# 3. frivolous CLI helpers to make debugging failed archiving easier
2024-10-04 07:08:18 +00:00
tree nano iputils-ping \
2023-10-31 06:25:51 +00:00
# nano iputils-ping dnsutils htop procps jq yq
2020-08-14 02:23:27 +00:00
&& rm -rf /var/lib/apt/lists/*
2019-01-23 06:06:47 +00:00
2024-10-04 07:08:18 +00:00
# Install sonic search backend
COPY --from= archivebox/sonic:1.4.9 /usr/local/bin/sonic /usr/local/bin/sonic
COPY --chown= root:root --chmod= 755 "etc/sonic.cfg" /etc/sonic.cfg
RUN ( which sonic && sonic --version) | tee -a /VERSION.txt
2023-10-20 09:47:34 +00:00
######### Language Environments ####################################
2020-08-11 16:52:43 +00:00
2023-10-20 09:47:34 +00:00
# Install Python environment
2023-11-01 02:43:41 +00:00
RUN --mount= type = cache,target= /var/cache/apt,sharing= locked,id= apt-$TARGETARCH $TARGETVARIANT --mount= type = cache,target= /root/.cache/pip,sharing= locked,id= pip-$TARGETARCH $TARGETVARIANT \
2023-10-31 12:31:19 +00:00
echo " [+] Setting up Python $PYTHON_VERSION runtime... " \
2024-10-04 07:16:03 +00:00
# NOT NEEDED because we're using a pre-built python image, keeping this here in case we switch back to custom-building our own:
2024-04-26 04:35:09 +00:00
# && apt-get update -qq \
# && apt-get install -qq -y -t bookworm-backports --no-upgrade \
2024-10-08 08:47:38 +00:00
# python${PYTHON_VERSION} python${PYTHON_VERSION}-minimal python3-pip python${PYTHON_VERSION}-venv pipx \
2024-04-26 04:35:09 +00:00
# && rm -rf /var/lib/apt/lists/* \
2023-10-31 06:25:51 +00:00
# tell PDM to allow using global system python site packages
2023-10-31 10:58:24 +00:00
# && rm /usr/lib/python3*/EXTERNALLY-MANAGED \
2024-10-08 08:47:38 +00:00
# && ln -s "$(which python${PYTHON_VERSION})" /usr/bin/python \
2023-10-31 06:25:51 +00:00
# create global virtual environment GLOBAL_VENV to use (better than using pip install --global)
2023-10-31 10:58:24 +00:00
# && python3 -m venv --system-site-packages --symlinks $GLOBAL_VENV \
# && python3 -m venv --system-site-packages $GLOBAL_VENV \
# && python3 -m venv $GLOBAL_VENV \
2023-10-31 06:25:51 +00:00
# install global dependencies / python build dependencies in GLOBAL_VENV
2023-11-01 02:43:41 +00:00
# && pip install --upgrade pip setuptools wheel \
2023-10-31 06:25:51 +00:00
# Save version info
&& ( \
which python3 && python3 --version | grep " $PYTHON_VERSION " \
2023-10-31 10:58:24 +00:00
&& which pip && pip --version \
# && which pdm && pdm --version \
2023-10-31 06:25:51 +00:00
&& echo -e '\n\n' \
) | tee -a /VERSION.txt
2020-04-23 01:13:49 +00:00
2024-04-26 04:35:09 +00:00
# Install Node environment
RUN --mount= type = cache,target= /var/cache/apt,sharing= locked,id= apt-$TARGETARCH $TARGETVARIANT --mount= type = cache,target= /root/.npm,sharing= locked,id= npm-$TARGETARCH $TARGETVARIANT \
2024-10-04 21:47:57 +00:00
echo " [+] Installing Node $NODE_VERSION environment... " \
2024-04-26 04:35:09 +00:00
&& echo " deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_ ${ NODE_VERSION } .x nodistro main " >> /etc/apt/sources.list.d/nodejs.list \
&& curl -fsSL "https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key" | gpg --dearmor | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& apt-get update -qq \
&& apt-get install -qq -y -t bookworm-backports --no-upgrade libatomic1 \
&& apt-get install -y -t bookworm-backports --no-upgrade \
nodejs \
&& rm -rf /var/lib/apt/lists/* \
# Update NPM to latest version
&& npm i -g npm --cache /root/.npm \
# Save version info
&& ( \
which node && node --version \
&& which npm && npm --version \
&& echo -e '\n\n' \
) | tee -a /VERSION.txt
2024-10-08 08:47:38 +00:00
2023-10-20 09:47:34 +00:00
######### Extractor Dependencies ##################################
2020-09-08 22:12:55 +00:00
2023-10-20 09:47:34 +00:00
# Install apt dependencies
2023-11-01 02:43:41 +00:00
RUN --mount= type = cache,target= /var/cache/apt,sharing= locked,id= apt-$TARGETARCH $TARGETVARIANT --mount= type = cache,target= /root/.cache/pip,sharing= locked,id= pip-$TARGETARCH $TARGETVARIANT \
2023-10-31 10:58:24 +00:00
echo "[+] Installing APT extractor dependencies globally using apt..." \
2023-10-20 11:08:38 +00:00
&& apt-get update -qq \
2024-04-26 04:35:09 +00:00
&& apt-get install -qq -y -t bookworm-backports \
2024-10-08 08:47:38 +00:00
curl wget git ffmpeg ripgrep \
2023-10-20 09:47:34 +00:00
# Packages we have also needed in the past:
# youtube-dl wget2 aria2 python3-pyxattr rtmpdump libfribidi-bin mpv \
2024-10-04 07:16:03 +00:00
&& rm -rf /var/lib/apt/lists/* \
2023-10-31 06:25:51 +00:00
# Save version info
2024-10-04 07:16:03 +00:00
&& ( \
which curl && curl --version | head -n1 \
&& which wget && wget --version 2>& 1 | head -n1 \
&& which git && git --version 2>& 1 | head -n1 \
&& which rg && rg --version 2>& 1 | head -n1 \
&& echo -e '\n\n' \
) | tee -a /VERSION.txt
2018-10-14 02:47:30 +00:00
2024-10-04 01:24:27 +00:00
2023-10-20 09:47:34 +00:00
# Install chromium browser using playwright
2023-11-01 02:43:41 +00:00
RUN --mount= type = cache,target= /var/cache/apt,sharing= locked,id= apt-$TARGETARCH $TARGETVARIANT --mount= type = cache,target= /root/.cache/pip,sharing= locked,id= pip-$TARGETARCH $TARGETVARIANT --mount= type = cache,target= /root/.cache/ms-playwright,sharing= locked,id= browsers-$TARGETARCH $TARGETVARIANT \
2023-10-31 10:58:24 +00:00
echo " [+] Installing Browser binary dependencies to $PLAYWRIGHT_BROWSERS_PATH ... " \
2023-10-20 11:08:38 +00:00
&& apt-get update -qq \
2024-04-26 04:35:09 +00:00
&& apt-get install -qq -y -t bookworm-backports \
2024-01-12 01:26:26 +00:00
fontconfig fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-khmeros fonts-kacst fonts-symbola fonts-noto fonts-freefont-ttf \
2024-04-26 04:35:09 +00:00
at-spi2-common fonts-liberation fonts-noto-color-emoji fonts-tlwg-loma-otf fonts-unifont libatk-bridge2.0-0 libatk1.0-0 libatspi2.0-0 libavahi-client3 \
libavahi-common-data libavahi-common3 libcups2 libfontenc1 libice6 libnspr4 libnss3 libsm6 libunwind8 \
libxaw7 libxcomposite1 libxdamage1 libxfont2 \
2024-10-05 05:29:32 +00:00
libxkbfile1 libxmu6 libxpm4 libxt6 x11-xkb-utils x11-utils xfonts-encodings \
2024-04-26 04:35:09 +00:00
# xfonts-scalable xfonts-utils xserver-common xvfb \
2024-01-12 03:02:34 +00:00
# chrome can run without dbus/upower technically, it complains about missing dbus but should run ok anyway
# libxss1 dbus dbus-x11 upower \
# && service dbus start \
2024-04-26 04:35:09 +00:00
# install Chromium using playwright
&& pip install playwright \
&& cp -r /root/.cache/ms-playwright " $PLAYWRIGHT_BROWSERS_PATH " \
&& playwright install chromium \
&& export CHROME_BINARY = " $( python -c 'from playwright.sync_api import sync_playwright; print(sync_playwright().start().chromium.executable_path)' ) " \
2023-10-31 06:25:51 +00:00
&& rm -rf /var/lib/apt/lists/* \
2023-10-20 09:47:34 +00:00
&& ln -s " $CHROME_BINARY " /usr/bin/chromium-browser \
&& mkdir -p " /home/ ${ ARCHIVEBOX_USER } /.config/chromium/Crash Reports/pending/ " \
2024-10-05 04:03:02 +00:00
&& chown -R " $DEFAULT_PUID : $DEFAULT_PGID " " /home/ ${ ARCHIVEBOX_USER } /.config " \
2023-11-14 03:18:41 +00:00
&& mkdir -p " $PLAYWRIGHT_BROWSERS_PATH " \
2023-11-07 09:42:16 +00:00
&& chown -R $ARCHIVEBOX_USER " $PLAYWRIGHT_BROWSERS_PATH " \
2023-10-31 06:25:51 +00:00
# Save version info
&& ( \
2023-12-18 06:11:13 +00:00
which chromium-browser && /usr/bin/chromium-browser --version || /usr/lib/chromium/chromium --version \
2023-10-31 06:25:51 +00:00
&& echo -e '\n\n' \
) | tee -a /VERSION.txt
2023-10-20 09:47:34 +00:00
# Install Node dependencies
2024-10-09 10:17:20 +00:00
ENV PATH = " /home/ $ARCHIVEBOX_USER /.npm/bin: $PATH "
2024-10-09 02:46:12 +00:00
USER $ARCHIVEBOX_USER
2024-10-09 10:17:20 +00:00
WORKDIR "/home/$ARCHIVEBOX_USER/.npm"
RUN --mount= type = cache,target= /home/$ARCHIVEBOX_USER /.npm_cache,sharing= locked,id= npm-$TARGETARCH $TARGETVARIANT ,uid= $DEFAULT_PUID ,gid= $DEFAULT_PGID \
echo " [+] Installing NPM extractor dependencies in /home/ $ARCHIVEBOX_USER /.npm... " \
&& npm config set prefix " /home/ $ARCHIVEBOX_USER /.npm " \
&& npm install --global --prefer-offline --no-fund --no-audit --cache " /home/ $ARCHIVEBOX_USER /.npm_cache " \
2024-10-09 02:46:12 +00:00
"@postlight/parser@^2.2.3" \
"readability-extractor@github:ArchiveBox/readability-extractor" \
"single-file-cli@^1.1.54" \
"puppeteer@^23.5.0" \
"@puppeteer/browsers@^2.4.0"
USER root
RUN ( \
2023-10-31 06:25:51 +00:00
which node && node --version \
&& which npm && npm version \
2024-10-09 02:46:12 +00:00
&& which postlight-parser \
&& which readability-extractor && readability-extractor --version \
&& which single-file && single-file --version \
&& which puppeteer && puppeteer --version \
2023-10-31 06:25:51 +00:00
&& echo -e '\n\n' \
) | tee -a /VERSION.txt
2023-10-20 09:47:34 +00:00
######### Build Dependencies ####################################
2021-02-16 20:55:47 +00:00
2023-10-31 06:58:13 +00:00
# Install ArchiveBox Python dependencies
WORKDIR "$CODE_DIR"
2023-11-14 04:57:31 +00:00
COPY --chown= root:root --chmod= 755 "./pyproject.toml" "requirements.txt" " $CODE_DIR " /
2023-11-01 02:43:41 +00:00
RUN --mount= type = cache,target= /var/cache/apt,sharing= locked,id= apt-$TARGETARCH $TARGETVARIANT --mount= type = cache,target= /root/.cache/pip,sharing= locked,id= pip-$TARGETARCH $TARGETVARIANT \
2023-11-14 04:57:31 +00:00
echo " [+] Installing PIP ArchiveBox dependencies from requirements.txt for ${ TARGETPLATFORM } ... " \
2023-10-31 06:58:13 +00:00
&& apt-get update -qq \
2024-04-26 04:35:09 +00:00
&& apt-get install -qq -y -t bookworm-backports \
2024-09-06 10:49:10 +00:00
build-essential gcc \
2023-10-31 12:31:19 +00:00
libssl-dev libldap2-dev libsasl2-dev \
2023-10-31 23:06:19 +00:00
python3-ldap python3-msgpack python3-mutagen python3-regex python3-pycryptodome procps \
2024-10-11 07:44:19 +00:00
pipx \
2023-10-31 10:58:24 +00:00
# && ln -s "$GLOBAL_VENV" "$APP_VENV" \
2023-10-31 10:06:02 +00:00
# && pdm use --venv in-project \
# && pdm run python -m ensurepip \
2023-10-31 08:05:39 +00:00
# && pdm sync --fail-fast --no-editable --group :all --no-self \
# && pdm export -o requirements.txt --without-hashes \
2023-10-31 10:58:24 +00:00
# && source $GLOBAL_VENV/bin/activate \
2023-10-31 10:19:35 +00:00
&& pip install -r requirements.txt \
2024-06-03 08:13:17 +00:00
&& apt-get purge -y \
2024-09-06 10:49:10 +00:00
build-essential gcc \
2023-10-31 10:06:02 +00:00
&& apt-get autoremove -y \
2023-10-31 06:58:13 +00:00
&& rm -rf /var/lib/apt/lists/*
2023-10-20 09:47:34 +00:00
# Install ArchiveBox Python package from source
2023-10-20 11:08:38 +00:00
COPY --chown= root:root --chmod= 755 "." " $CODE_DIR / "
2024-10-04 07:16:03 +00:00
RUN --mount= type = cache,target= /root/.cache/pip,sharing= locked,id= pip-$TARGETARCH $TARGETVARIANT \
2023-10-31 10:58:24 +00:00
echo " [*] Installing PIP ArchiveBox package from $CODE_DIR ... " \
2024-10-08 08:47:38 +00:00
&& pip install -e " ${ CODE_DIR } [all] " \
2023-10-31 06:25:51 +00:00
&& rm -rf /var/lib/apt/lists/*
2023-10-20 09:47:34 +00:00
####################################################
2020-08-14 02:23:27 +00:00
# Setup ArchiveBox runtime config
2023-10-20 11:08:38 +00:00
WORKDIR "$DATA_DIR"
2024-10-05 11:17:58 +00:00
RUN openssl rand -hex 16 > /etc/machine-id \
2024-10-21 07:36:53 +00:00
&& mkdir -p "/tmp/archivebox" \
&& chown -R " $DEFAULT_PUID : $DEFAULT_PGID " "/tmp/archivebox" \
&& mkdir -p "/usr/share/archivebox/lib" \
2024-10-21 10:16:07 +00:00
&& chown -R " $DEFAULT_PUID : $DEFAULT_PGID " "/usr/share/archivebox/lib"
2024-10-08 08:47:38 +00:00
ENV GOOGLE_API_KEY = no \
2024-03-18 21:41:57 +00:00
GOOGLE_DEFAULT_CLIENT_ID = no \
GOOGLE_DEFAULT_CLIENT_SECRET = no \
2024-10-21 07:36:53 +00:00
TMP_DIR = /tmp/archivebox \
LIB_DIR = /usr/share/archivebox/lib \
2024-03-18 21:41:57 +00:00
ALLOWED_HOSTS = *
2018-10-14 02:47:30 +00:00
2020-08-14 02:23:27 +00:00
# Print version for nice docker finish summary
2023-10-31 06:25:51 +00:00
RUN ( echo -e "\n\n[√] Finished Docker build succesfully. Saving build summary in: /VERSION.txt" \
2023-12-18 00:04:48 +00:00
&& echo -e " PLATFORM= ${ TARGETPLATFORM } ARCH= $( uname -m) ( $( uname -s) ${ TARGETARCH } ${ TARGETVARIANT } )\n " \
&& echo -e " BUILD_END_TIME= $( date +"%Y-%m-%d %H:%M:%S %s" ) \n\n " \
2023-10-31 06:25:51 +00:00
) | tee -a /VERSION.txt
2023-12-18 01:44:26 +00:00
RUN " $CODE_DIR " /bin/docker_entrypoint.sh version 2>& 1 | tee -a /VERSION.txt
2023-10-20 09:47:34 +00:00
####################################################
2018-10-14 02:47:30 +00:00
2020-08-14 02:23:27 +00:00
# Open up the interfaces to the outside world
2023-10-31 06:25:51 +00:00
WORKDIR "$DATA_DIR"
VOLUME "$DATA_DIR"
2020-08-14 02:23:27 +00:00
EXPOSE 8000
2020-07-22 05:30:58 +00:00
2024-02-22 12:47:01 +00:00
HEALTHCHECK --interval=30s --timeout=20s --retries=15 \
CMD curl --silent 'http://localhost:8000/health/' | grep -q 'OK'
2021-02-17 23:24:38 +00:00
2020-08-10 18:15:53 +00:00
ENTRYPOINT [ "dumb-init" , "--" , "/app/bin/docker_entrypoint.sh" ]
2021-03-01 03:53:23 +00:00
CMD [ "archivebox" , "server" , "--quick-init" , "0.0.0.0:8000" ]