diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6a58a26 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,37 @@ +FROM python:3.11-slim + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + build-essential \ + curl \ + && rm -rf /var/lib/apt/lists/* + +# Set working directory +WORKDIR /app + +# Copy requirements and install Python dependencies +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +# Copy source code and project files +COPY src/ src/ +COPY pyproject.toml . +COPY README.md . + +# Install the package +RUN pip install -e . + +# Create non-root user +RUN useradd -r -u 1001 appuser && \ + chown -R appuser:appuser /app +USER appuser + +# Expose default port for SSE mode +EXPOSE 8000 + +# Health check +HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ + CMD python -c "import pymilvus; print('OK')" || exit 1 + +# Default command +CMD ["mcp-server-milvus", "--sse", "--port", "8000"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7caf59c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: '3.8' + +services: + mcp-server-milvus: + build: . + container_name: mcp-server-milvus + ports: + - "${MCP_PORT:-8000}:8000" + environment: + - MILVUS_HOST=milvus-standalone + - MILVUS_PORT=19530 + - MILVUS_USER=${MILVUS_USER} + - MILVUS_PASSWORD=${MILVUS_PASSWORD} + - MILVUS_DB_NAME=${MILVUS_DB_NAME:-default} + restart: unless-stopped + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8000/health"] + interval: 30s + timeout: 10s + retries: 3 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..f7523dc --- /dev/null +++ b/requirements.txt @@ -0,0 +1,5 @@ +fastmcp>=2.6.1 +pymilvus>=2.5.1 +click>=8.0.0 +ruff>=0.11.0 +python-dotenv>=1.0.0 \ No newline at end of file