From 4e38ab94d61633dede59e78e717bed200f573c88 Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Mon, 1 Jun 2026 10:22:04 -0700 Subject: [PATCH] fix: pin docker validation binary paths --- Dockerfile | 4 +++- Dockerfile.multistage | 2 +- archivebox/tests/test_dockerfiles.py | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 12dd5fed..fbb08fa8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -318,6 +318,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-$TARGETARCH$T && apt-get update -qq \ && apt-get install -qq -y --no-install-recommends build-essential tesseract-ocr tesseract-ocr-eng \ && abxpkg install --no-cache --binproviders=pip --bin-dir="$LIB_DIR/env/bin" gallery-dl \ + && abxpkg install --no-cache --binproviders=pip --bin-dir="$LIB_DIR/env/bin" --overrides='{"pip":{"install_args":["--no-deps","forum-dl","chardet==5.2.0","pydantic==2.12.3","pydantic-core==2.41.4","typing-extensions>=4.14.1","annotated-types>=0.6.0","typing-inspection>=0.4.2","beautifulsoup4","soupsieve","lxml","requests","urllib3","certifi","idna","charset-normalizer","tenacity","python-dateutil","six","html2text","warcio"]}}' forum-dl \ && if [ "$TARGETARCH" = "arm64" ]; then \ abxpkg install --binproviders=npm --overrides='{"npm":{"install_args":["playwright@next"]}}' playwright; \ abxpkg install --no-cache --install-timeout=600 --binproviders=playwright --bin-dir="$LIB_DIR/env/bin" chromium; \ @@ -337,6 +338,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,id=apt-$TARGETARCH$T && ln -sf "$(command -v node)" "$LIB_DIR/env/bin/node" \ && ln -sf "$(command -v npm)" "$LIB_DIR/env/bin/npm" \ && ln -sf "$(command -v java)" "$LIB_DIR/env/bin/java" \ + && ln -sf "$(command -v git)" "$LIB_DIR/env/bin/git" \ && ln -sf "$(command -v rg)" "$LIB_DIR/env/bin/rg" \ && ln -sf "$(command -v sonic)" "$LIB_DIR/env/bin/sonic" \ && find "$LIB_DIR" -type d -name __pycache__ -prune -exec rm -rf {} + \ @@ -395,7 +397,7 @@ RUN (echo -e "\n\n[√] Finished Docker build successfully. Saving build summary RUN chmod +x "$CODE_DIR"/bin/*.sh \ && chown -R "$DEFAULT_PUID:$DEFAULT_PGID" "$LIB_DIR" \ && chmod g+w "$TMP_DIR" "$LIB_DIR" "$LIB_DIR"/bin "$PLAYWRIGHT_BROWSERS_PATH" \ - && ABXPKG_INSTALL_TIMEOUT=600 ABXPKG_POSTINSTALL_SCRIPTS=True ABXPKG_MIN_RELEASE_AGE=0 TIMEOUT=600 gosu "$ARCHIVEBOX_USER" archivebox install archivewebpage defuddle forumdl gallerydl git istilldontcareaboutcookies liteparse mercury papersdl parse_rss_urls readability search_backend_sonic opendataloader search_backend_ripgrep 2>&1 | tee -a /VERSION.txt \ + && GIT_BINARY="$LIB_DIR/env/bin/git" GALLERYDL_BINARY="$LIB_DIR/env/bin/gallery-dl" FORUMDL_BINARY="$LIB_DIR/env/bin/forum-dl" ABXPKG_INSTALL_TIMEOUT=600 ABXPKG_POSTINSTALL_SCRIPTS=True ABXPKG_MIN_RELEASE_AGE=0 TIMEOUT=600 gosu "$ARCHIVEBOX_USER" archivebox install archivewebpage defuddle forumdl gallerydl git istilldontcareaboutcookies liteparse mercury papersdl parse_rss_urls readability search_backend_sonic opendataloader search_backend_ripgrep 2>&1 | tee -a /VERSION.txt \ && gosu "$ARCHIVEBOX_USER" archivebox version 2>&1 | tee -a /VERSION.txt \ && find /venv "$CODE_DIR" "$LIB_DIR" "$DATA_DIR" -type d -name __pycache__ -prune -exec rm -rf {} + \ && find /venv "$CODE_DIR" "$LIB_DIR" "$DATA_DIR" -type f \( -name '*.pyc' -o -name '*.pyo' \) -delete \ diff --git a/Dockerfile.multistage b/Dockerfile.multistage index 40ee9b30..1d163826 100644 --- a/Dockerfile.multistage +++ b/Dockerfile.multistage @@ -199,7 +199,7 @@ RUN echo "[+] Initializing image collection..." \ RUN chmod +x "$CODE_DIR"/bin/*.sh \ && chown -R "$DEFAULT_PUID:$DEFAULT_PGID" "$LIB_DIR" \ && chmod g+w "$TMP_DIR" "$LIB_DIR" "$PLAYWRIGHT_BROWSERS_PATH" \ - && ABXPKG_INSTALL_TIMEOUT=600 ABXPKG_POSTINSTALL_SCRIPTS=True ABXPKG_MIN_RELEASE_AGE=0 TIMEOUT=600 gosu "$ARCHIVEBOX_USER" archivebox install archivewebpage defuddle forumdl gallerydl git istilldontcareaboutcookies liteparse mercury papersdl parse_rss_urls readability search_backend_ripgrep search_backend_sonic 2>&1 | tee -a /VERSION.txt \ + && GIT_BINARY="$LIB_DIR/env/bin/git" GALLERYDL_BINARY="$LIB_DIR/env/bin/gallery-dl" FORUMDL_BINARY="$LIB_DIR/env/bin/forum-dl" ABXPKG_INSTALL_TIMEOUT=600 ABXPKG_POSTINSTALL_SCRIPTS=True ABXPKG_MIN_RELEASE_AGE=0 TIMEOUT=600 gosu "$ARCHIVEBOX_USER" archivebox install archivewebpage defuddle forumdl gallerydl git istilldontcareaboutcookies liteparse mercury papersdl parse_rss_urls readability search_backend_ripgrep search_backend_sonic 2>&1 | tee -a /VERSION.txt \ && "$LIB_DIR/env/bin/chromium" --version | tee -a /VERSION.txt \ && "$LIB_DIR/pip/packages/papers-dl/venv/bin/papers-dl" --version | tee -a /VERSION.txt \ && /usr/bin/rg --version | head -1 | tee -a /VERSION.txt \ diff --git a/archivebox/tests/test_dockerfiles.py b/archivebox/tests/test_dockerfiles.py index 299dab83..aa090b71 100644 --- a/archivebox/tests/test_dockerfiles.py +++ b/archivebox/tests/test_dockerfiles.py @@ -97,3 +97,11 @@ def test_dockerfiles_clean_build_data_dir_before_init() -> None: for dockerfile_name in ("Dockerfile", "Dockerfile.multistage"): text = (REPO_ROOT / dockerfile_name).read_text() assert 'find "$DATA_DIR" -mindepth 1 -maxdepth 1 -exec rm -rf {} +' in text + + +def test_dockerfiles_pin_project_binary_paths_for_validation() -> None: + for dockerfile_name in ("Dockerfile", "Dockerfile.multistage"): + text = (REPO_ROOT / dockerfile_name).read_text() + assert 'GIT_BINARY="$LIB_DIR/env/bin/git"' in text + assert 'GALLERYDL_BINARY="$LIB_DIR/env/bin/gallery-dl"' in text + assert 'FORUMDL_BINARY="$LIB_DIR/env/bin/forum-dl"' in text