# MCP Server Dockerfile

# Use official Python image
FROM python:3.11-slim

# Set working directory
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Copy requirements first to leverage Docker cache
COPY mcp_server/requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# Copy MCP server code
COPY mcp_server/ ./mcp_server/

# Copy website content (for read-only access)
COPY blogs/ ./blogs/
COPY services/ ./services/
COPY stories/ ./stories/
COPY partner/ ./partner/
COPY start-poc/ ./start-poc/
COPY jarakube/ ./jarakube/
COPY pricing/ ./pricing/

# Create non-root user for security
RUN useradd -m -u 1000 mcpuser
USER mcpuser

# Expose port
EXPOSE 8081

# Set environment variables
ENV MCP_HOST=0.0.0.0
ENV MCP_PORT=8081
ENV CONTENT_ROOT=/app
ENV LOG_LEVEL=INFO

# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
    CMD curl -f http://localhost:8081/health || exit 1

# Run the MCP server
CMD ["python", "-m", "mcp_server.server"]
