From aa530524a318940aac342ea96997a4883d875152 Mon Sep 17 00:00:00 2001 From: Vadim Malanov Date: Sun, 14 Jun 2026 13:42:25 +0300 Subject: [PATCH] build(docker): reliable apt mirror and correct build context - The default deb.debian.org Cloudflare CDN throttled to ~150 kB/s from this network and repeatedly dropped the gcc-12/cpp-12 fetch, failing the image build twice. Switch apt to mirror.yandex.ru and add Acquire retry/timeout options so the system-dependency layer (OCRmyPDF, Tesseract rus+eng, Ghostscript, qpdf) builds reliably. - Copy pyproject.toml, README.md, alembic.ini and the app/scripts packages before "pip install -e ." so hatchling's editable build can validate the readme and packages (previously failed with "Readme file does not exist: README.md"). - Drop README.md from .dockerignore so the build context includes it. - Ignore local preview launch config (frontend/.claude, .claude/launch.json). Co-Authored-By: Claude Opus 4.8 (1M context) --- .dockerignore | 1 - .gitignore | 4 ++++ docker/Dockerfile | 26 +++++++++++++++++++------- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.dockerignore b/.dockerignore index 9e5635b..f446d9e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -13,4 +13,3 @@ tests .ruff_cache .idea .vscode -README.md diff --git a/.gitignore b/.gitignore index cb79ced..7a836be 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,7 @@ data/work/* !data/work/.gitkeep *.log .DS_Store + +# local preview launch config +frontend/.claude/ +.claude/launch.json diff --git a/docker/Dockerfile b/docker/Dockerfile index 59b5b1e..bd0883a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -6,8 +6,19 @@ ENV PYTHONUNBUFFERED=1 \ PIP_DISABLE_PIP_VERSION_CHECK=1 \ DEBIAN_FRONTEND=noninteractive +# Switch apt to a faster mirror (Yandex) before installing. The default +# deb.debian.org Cloudflare CDN throttles to ~150 kB/s from some networks, +# stalling the build on gcc-12/cpp-12; Yandex serves consistently faster. +RUN sed -i 's|deb.debian.org|mirror.yandex.ru|g' /etc/apt/sources.list.d/debian.sources 2>/dev/null \ + || sed -i 's|deb.debian.org|mirror.yandex.ru|g' /etc/apt/sources.list 2>/dev/null \ + || true + # System deps for OCRmyPDF + Tesseract (rus+eng) + Ghostscript + qpdf + image libs -RUN apt-get update && apt-get install -y --no-install-recommends \ +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + --fix-missing -o Acquire::Retries=10 \ + -o Acquire::http::Timeout=180 \ + -o Acquire::https::Timeout=180 \ build-essential \ curl \ ca-certificates \ @@ -33,14 +44,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ WORKDIR /app -COPY pyproject.toml /app/pyproject.toml - -RUN pip install --upgrade pip wheel setuptools && \ - pip install -e . - +# Copy the metadata + package payload BEFORE pip install. hatchling validates +# README.md and the [packages] entries (app, scripts) at editable-install time; +# missing files cause `Readme file does not exist` even with `pip install -e .`. +COPY pyproject.toml README.md alembic.ini /app/ COPY app /app/app COPY scripts /app/scripts -COPY alembic.ini /app/alembic.ini + +RUN pip install --upgrade pip wheel setuptools \ + && pip install -e . RUN mkdir -p /data/input /data/work