# Syndarix LLM Gateway MCP Server # Multi-stage build for minimal image size # Build stage FROM python:3.12-slim AS builder # Install uv for fast package management COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv WORKDIR /app # Copy dependency files COPY pyproject.toml ./ # Create virtual environment and install dependencies RUN uv venv /app/.venv ENV PATH="/app/.venv/bin:$PATH" RUN uv pip install -e . # Runtime stage FROM python:3.12-slim AS runtime # Create non-root user for security RUN groupadd --gid 1000 appgroup && \ useradd --uid 1000 --gid appgroup --shell /bin/bash --create-home appuser WORKDIR /app # Copy virtual environment from builder COPY --from=builder /app/.venv /app/.venv ENV PATH="/app/.venv/bin:$PATH" # Copy application code COPY --chown=appuser:appgroup . . # Switch to non-root user 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()" || exit 1 # Run the server CMD ["python", "server.py"]