diff --git a/dzen-assistant/.dockerignore b/dzen-assistant/.dockerignore new file mode 100644 index 0000000..d4e0e62 --- /dev/null +++ b/dzen-assistant/.dockerignore @@ -0,0 +1,18 @@ +.env +.git +.pytest_cache +.ruff_cache +__pycache__ +*.pyc + +admin/dist +admin/node_modules + +data +*.sqlite +*.sqlite3 + +Dockerfile +docker-compose*.yml +README.md +DEPLOY.md diff --git a/dzen-assistant/Dockerfile b/dzen-assistant/Dockerfile index dad64ac..734fef3 100644 --- a/dzen-assistant/Dockerfile +++ b/dzen-assistant/Dockerfile @@ -1,11 +1,22 @@ FROM node:22-alpine AS admin-build WORKDIR /admin COPY admin/package*.json ./ -RUN npm install +RUN npm ci --no-audit --no-fund COPY admin ./ RUN npm run build -FROM python:3.12-slim +FROM python:3.12-slim AS python-wheels + +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 + +WORKDIR /build + +COPY requirements.txt requirements-yt-dlp.txt ./ +RUN python -m pip install --no-cache-dir --upgrade pip wheel \ + && python -m pip wheel --no-cache-dir --wheel-dir /wheels -r requirements.txt -r requirements-yt-dlp.txt + +FROM python:3.12-slim AS runtime ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 @@ -13,12 +24,13 @@ ENV PYTHONUNBUFFERED=1 WORKDIR /app RUN apt-get update \ - && apt-get install -y --no-install-recommends ffmpeg ca-certificates curl libgomp1 \ + && apt-get install -y --no-install-recommends ffmpeg ca-certificates libgomp1 \ && rm -rf /var/lib/apt/lists/* -COPY requirements.txt . -RUN pip install --no-cache-dir -r requirements.txt \ - && pip install --no-cache-dir yt-dlp +COPY requirements.txt requirements-yt-dlp.txt ./ +COPY --from=python-wheels /wheels /wheels +RUN python -m pip install --no-cache-dir --no-index --find-links=/wheels -r requirements.txt -r requirements-yt-dlp.txt \ + && rm -rf /wheels COPY app ./app COPY --from=admin-build /admin/dist ./admin_dist diff --git a/dzen-assistant/README.md b/dzen-assistant/README.md index d3ad8af..3136e97 100644 --- a/dzen-assistant/README.md +++ b/dzen-assistant/README.md @@ -60,8 +60,8 @@ LLM_API_KEY=... LLM_MODEL=agent ``` -Агент должен отвечать JSON со списком статей. Если агент временно недоступен, конвейер создаст простой -fallback-черновик из транскрипта. +Агент должен отвечать JSON со списком статей. Если агент временно недоступен, конвейер покажет +ошибку обработки и не создаст черновик из сырой транскрибации. ## MVP-поток diff --git a/dzen-assistant/admin/index.html b/dzen-assistant/admin/index.html index 9c9f964..c5c43f9 100644 --- a/dzen-assistant/admin/index.html +++ b/dzen-assistant/admin/index.html @@ -3,11 +3,18 @@
+