- 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
54 lines
1.9 KiB
Docker
54 lines
1.9 KiB
Docker
# #region docker.backend.Dockerfile [C:3] [TYPE Module] [SEMANTICS docker,backend,build]
|
||
# @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-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
|
||
|
||
ENV PYTHONDONTWRITEBYTECODE=1
|
||
ENV PYTHONUNBUFFERED=1
|
||
ENV BACKEND_PORT=8000
|
||
|
||
WORKDIR /app
|
||
|
||
# Системные зависимости
|
||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||
ca-certificates \
|
||
curl \
|
||
git \
|
||
libnss3-tools \
|
||
&& rm -rf /var/lib/apt/lists/*
|
||
|
||
# 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
|
||
COPY docker/certs.sh /app/certs.sh
|
||
COPY docker/backend.entrypoint.sh /app/entrypoint.sh
|
||
RUN chmod +x /app/entrypoint.sh
|
||
|
||
WORKDIR /app/backend
|
||
|
||
EXPOSE 8000
|
||
|
||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||
CMD ["python", "-m", "uvicorn", "src.app:app", "--host", "0.0.0.0", "--port", "8000"]
|
||
# #endregion docker.backend.Dockerfile
|