* feat: enhance coverage reporting and improve tool configuration - Added support for JSON coverage reports in pyproject.toml. - Updated .gitignore to include coverage.json and task files for better management. - Introduced a new Type Safety Audit Report to document findings and recommendations for type safety improvements. - Created a comprehensive coverage configuration guide to assist in understanding coverage reporting setup. - Refactored tools configuration to utilize environment variables for concurrent scraping settings. These changes improve the project's testing and reporting capabilities while enhancing overall code quality and maintainability. * feat: enhance configuration handling and improve error logging - Introduced a new utility function `_get_env_int` for robust environment variable integer retrieval with validation. - Updated `WebToolsConfig` and `ToolsConfigModel` to utilize the new utility for environment variable defaults. - Enhanced logging in `CircuitBreaker` to provide detailed state transition information. - Improved URL handling in `url_analyzer.py` for better file extension extraction and normalization. - Added type validation and logging in `SecureInputMixin` to ensure input sanitization and validation consistency. These changes improve the reliability and maintainability of configuration management and error handling across the codebase. * refactor: update imports and enhance .gitignore for improved organization - Updated import paths in various example scripts to reflect the new structure under `biz_bud`. - Enhanced .gitignore to include clearer formatting for task files. - Removed obsolete function calls and improved error handling in several scripts. - Added public alias for backward compatibility in `upload_r2r.py`. These changes improve code organization, maintainability, and compatibility across the project. * refactor: update graph paths in langgraph.json for improved organization - Changed paths for research, catalog, paperless, and url_to_r2r graphs to reflect new directory structure. - Added new entries for analysis and scraping graphs to enhance functionality. These changes improve the organization and maintainability of the graph configurations. * fix: enhance validation and error handling in date range and scraping functions - Updated date validation in UserFiltersModel to ensure date values are strings. - Improved error messages in create_scraped_content_dict to clarify conditions for success and failure. - Enhanced test coverage for date validation and scraping content creation to ensure robustness. These changes improve input validation and error handling across the application, enhancing overall reliability. * refactor: streamline graph creation and enhance type annotations in examples - Simplified graph creation in `catalog_ingredient_research_example.py` and `catalog_tech_components_example.py` by directly compiling the graph. - Updated type annotations in `catalog_intel_with_config.py` for improved clarity and consistency. - Enhanced error handling in catalog data processing to ensure robustness against unexpected data types. These changes improve code readability, maintainability, and error resilience across example scripts. * Update src/biz_bud/nodes/extraction/extractors.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Update src/biz_bud/core/validation/pydantic_models.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * refactor: migrate Jina and Tavily clients to use ServiceFactory dependency injection * refactor: migrate URL processing to provider-based architecture with improved error handling * feat: add FirecrawlApp compatibility classes and mock implementations * fix: add thread-safe locking to LazyLoader factory management * feat: implement service restart and refactor cache decorator helpers * refactor: move r2r_direct_api_call to tools.clients.r2r_utils and improve HTTP service error handling * chore: update Sonar task IDs in report configuration --------- Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
77 lines
2.1 KiB
Docker
77 lines
2.1 KiB
Docker
# Production Dockerfile for Business Buddy FastAPI with LangGraph
|
|
FROM python:3.12-slim
|
|
|
|
# Set environment variables
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
DEBIAN_FRONTEND=noninteractive \
|
|
TZ=UTC
|
|
|
|
# Install system dependencies, UV package manager, Node.js, and Python packages
|
|
RUN apt-get update && apt-get install -y \
|
|
build-essential \
|
|
ca-certificates \
|
|
curl \
|
|
git \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& pip install --no-cache-dir uv \
|
|
&& curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
|
|
&& apt-get install -y nodejs \
|
|
&& apt-get clean \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& pip install --no-cache-dir langgraph-cli uvicorn
|
|
|
|
# Create app user
|
|
RUN useradd --create-home --shell /bin/bash app
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy dependency files one by one to ensure they're included
|
|
COPY pyproject.toml ./
|
|
COPY uv.lock ./
|
|
# Create a default README.md and copy it
|
|
RUN echo "# Business Buddy\n\nDocker build placeholder README" > /tmp/README.md
|
|
# Try to copy README.md if it exists, otherwise use the default
|
|
RUN if [ -f README.md ]; then \
|
|
echo "Using provided README.md"; \
|
|
else \
|
|
cp /tmp/README.md ./; \
|
|
echo "Using default README.md"; \
|
|
fi
|
|
# Copy packages directory
|
|
COPY packages/ ./packages/
|
|
|
|
# Copy application code first
|
|
COPY src/ ./src/
|
|
COPY langgraph.json config.yaml ./
|
|
|
|
# Set PYTHONPATH to include the src directory
|
|
ENV PYTHONPATH=/app/src
|
|
|
|
# Install the package and its dependencies
|
|
RUN uv pip install --system .
|
|
|
|
# Install production dependencies only
|
|
RUN uv sync --frozen --no-dev
|
|
# Remove this line - use environment variables or runtime secrets instead
|
|
|
|
# Set proper ownership
|
|
RUN chown -R app:app /app
|
|
|
|
# Switch to app user
|
|
USER app
|
|
|
|
# Create directories for logs and data
|
|
RUN mkdir -p /app/logs /app/data
|
|
|
|
# Expose port
|
|
EXPOSE 8000
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:8000/health || exit 1
|
|
|
|
# Set the entrypoint to run the FastAPI app with uvicorn using Python module path
|
|
ENTRYPOINT ["python", "-m", "uvicorn", "biz_bud.webapp:app", "--host", "0.0.0.0", "--port", "8000"]
|