Files
rag-service/Dockerfile

44 lines
1.5 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# RAG Service Dockerfile
# Python 3.11.9 для совместимости с основным ботом
FROM python:3.11.9-slim
# Рабочая директория
WORKDIR /app
# Системные зависимости
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Копируем зависимости
COPY requirements.txt .
# Устанавливаем зависимости (CPU-only torch для контейнеров без GPU)
RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu \
&& pip install --no-cache-dir -r requirements.txt
# Копируем код приложения
COPY app/ ./app/
# Создаем директории для данных
RUN mkdir -p data/models data/vectors
# Переменные окружения по умолчанию
ENV RAG_MODEL=sentence-transformers/all-MiniLM-L12-v2
ENV RAG_CACHE_DIR=/app/data/models
ENV RAG_VECTORS_PATH=/app/data/vectors/vectors.npz
ENV RAG_API_HOST=0.0.0.0
ENV RAG_API_PORT=8000
ENV LOG_LEVEL=INFO
# Порт приложения
EXPOSE 8000
# Healthcheck (использует простой endpoint /health без авторизации)
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1
# Запуск приложения
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]