forked from cardosofelipe/fast-next-template
- Refactored database batch operations to ensure transaction atomicity and simplify nested structure. - Added `Makefile` for `knowledge-base` and `llm-gateway` modules to streamline development workflows. - Simplified `Dockerfile` for `llm-gateway` by removing multi-stage builds and optimizing dependencies. - Improved code readability in `collection_manager` and `failover` modules with refined logic. - Minor fixes in `test_server` and Redis health check handling for better diagnostics.
40 lines
991 B
Docker
40 lines
991 B
Docker
# Syndarix LLM Gateway MCP Server
|
|
FROM python:3.12-slim
|
|
|
|
WORKDIR /app
|
|
|
|
# Install system dependencies (needed for tiktoken regex compilation)
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
build-essential \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install uv for fast package management
|
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
|
|
|
|
# Copy project files
|
|
COPY pyproject.toml ./
|
|
COPY *.py ./
|
|
|
|
# Install dependencies to system Python
|
|
RUN uv pip install --system --no-cache .
|
|
|
|
# Create non-root user for security
|
|
RUN useradd --create-home --shell /bin/bash appuser
|
|
USER appuser
|
|
|
|
# Environment variables
|
|
ENV LLM_GATEWAY_HOST=0.0.0.0
|
|
ENV LLM_GATEWAY_PORT=8001
|
|
ENV PYTHONUNBUFFERED=1
|
|
ENV PYTHONDONTWRITEBYTECODE=1
|
|
|
|
# Expose port
|
|
EXPOSE 8001
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD python -c "import httpx; httpx.get('http://localhost:8001/health').raise_for_status()"
|
|
|
|
# Run the server
|
|
CMD ["python", "server.py"]
|