refactor(agent): extract agent+shared into standalone packages with full GRACE semantic markup
- Move agent code from backend/src/agent/ to agent/src/ss_tools/agent/ - Extract shared stdlib-only utilities to shared/src/ss_tools/shared/ - Add #region/#endregion contracts to all ~140 functions (INV_1 compliance) - Update docker files, entrypoint, build scripts for new package layout - Backend now imports ss_tools.shared._llm_health (no gradio/langchain deps) - Add specs for 036-039 feature plans
This commit is contained in:
@@ -2,9 +2,10 @@
|
||||
# @BRIEF Backend Dockerfile — Python 3.11 slim + Playwright + entrypoint с установкой сертификатов.
|
||||
# @LAYER Infrastructure
|
||||
# @RELATION DEPENDS_ON -> [EXT:path:docker/backend.entrypoint.sh]
|
||||
# @RELATION DEPENDS_ON -> [EXT:path:backend/requirements.txt]
|
||||
# @PRE Docker builder context — корень проекта. backend/ и docker/ доступны.
|
||||
# @POST Образ с backend API, Playwright, entrypoint для bootstrap admin и установки сертификатов.
|
||||
# @RELATION DEPENDS_ON -> [EXT:path:backend/requirements-backend.txt]
|
||||
# @RELATION DEPENDS_ON -> [EXT:path:shared/pyproject.toml]
|
||||
# @PRE Docker builder context — корень проекта. backend/, shared/, docker/ доступны.
|
||||
# @POST Образ с backend API, Playwright, shared-утилитами, entrypoint для bootstrap admin.
|
||||
|
||||
FROM python:3.11-slim
|
||||
|
||||
@@ -14,8 +15,7 @@ ENV BACKEND_PORT=8000
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Системные зависимости: ca-certificates для корп. сертификатов, libnss3-tools
|
||||
# для установки CA в NSS базу Chromium, curl, git для Playwright/GitPython
|
||||
# Системные зависимости
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
curl \
|
||||
@@ -23,15 +23,23 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libnss3-tools \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Python зависимости — backend runtime (agent/ML deps excluded)
|
||||
# Python зависимости — backend runtime
|
||||
COPY backend/requirements-backend.txt /app/backend/requirements-backend.txt
|
||||
RUN pip install --no-cache-dir -r /app/backend/requirements-backend.txt
|
||||
|
||||
# Install shared package (LLM health, SSL, cot_logger)
|
||||
COPY shared/ /app/shared/
|
||||
RUN pip install --no-cache-dir -e /app/shared/
|
||||
|
||||
# Install shared LLM deps (openai, httpx for _llm_health)
|
||||
RUN pip install --no-cache-dir "openai>=1.0.0" "httpx>=0.28.1"
|
||||
|
||||
RUN python -m playwright install --with-deps chromium
|
||||
|
||||
# Исходный код
|
||||
COPY backend/ /app/backend/
|
||||
|
||||
# Копируем shared certs.sh и entrypoint — установит корп. сертификаты, Playwright и сделает bootstrap admin
|
||||
# Копируем shared certs.sh и entrypoint
|
||||
COPY docker/certs.sh /app/certs.sh
|
||||
COPY docker/backend.entrypoint.sh /app/entrypoint.sh
|
||||
RUN chmod +x /app/entrypoint.sh
|
||||
@@ -42,4 +50,4 @@ EXPOSE 8000
|
||||
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
CMD ["python", "-m", "uvicorn", "src.app:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
# #endregion docker.backend.Dockerfile
|
||||
# #endregion docker.backend.Dockerfile
|
||||
|
||||
Reference in New Issue
Block a user