FROM python:3.11-slim WORKDIR /app # Install system dependencies and Poetry RUN apt-get update && apt-get install -y \ gcc \ g++ \ && rm -rf /var/lib/apt/lists/* \ && pip install --no-cache-dir poetry==1.7.1 # Copy dependency files COPY pyproject.toml ./ # Configure Poetry and install dependencies RUN poetry config virtualenvs.create false \ && poetry install --no-dev --no-interaction --no-ansi # Copy source code COPY src/ ./src/ # Download embedding model during build (cache it) and create data directory # Note: This downloads ~1.1GB for multilingual support RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('paraphrase-multilingual-mpnet-base-v2')" \ && mkdir -p /app/data # Expose port EXPOSE 8080 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ CMD python -c "import requests; requests.get('http://localhost:8080/health')" || exit 1 # Run application CMD ["python", "-m", "uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8080"]