-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
59 lines (44 loc) · 1.28 KB
/
Dockerfile
File metadata and controls
59 lines (44 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Build stage
FROM python:3.11-slim as builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
gcc \
g++ \
libxml2-dev \
libxslt1-dev \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /build
# Copy requirements
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --user -r requirements.txt
# Runtime stage
FROM python:3.11-slim
# Install runtime dependencies only
RUN apt-get update && apt-get install -y \
libxml2 \
libxslt1.1 \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN useradd -m -u 1000 mcp && \
mkdir -p /app/logs && \
chown -R mcp:mcp /app
# Set working directory
WORKDIR /app
# Copy Python packages from builder
COPY --from=builder /root/.local /home/mcp/.local
# Copy application code
COPY --chown=mcp:mcp . .
# Set Python path
ENV PATH=/home/mcp/.local/bin:$PATH
ENV PYTHONPATH=/app:$PYTHONPATH
# Switch to non-root user
USER mcp
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD python3 -c "import sys; sys.path.insert(0, '/app'); from mcp_local.server import app; print('OK')" || exit 1
# MCP communique via stdio, pas de port à exposer
# EXPOSE 9090
# Run the MCP server
CMD ["python3", "mcp_local/server.py"]