-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (35 loc) · 1.25 KB
/
Dockerfile
File metadata and controls
49 lines (35 loc) · 1.25 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
# Multi-stage build for Predictive Maintenance MCP Server
FROM python:3.11-slim AS builder
WORKDIR /app
# Install build dependencies
RUN pip install --no-cache-dir --upgrade pip setuptools wheel
# Copy dependency files first for layer caching
COPY pyproject.toml ./
COPY src/ ./src/
# Install the package (with uvicorn for SSE/HTTP transport)
RUN pip install --no-cache-dir ".[full]" uvicorn
# --- Production stage ---
FROM python:3.11-slim
WORKDIR /app
# Copy installed packages from builder
COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin /usr/local/bin
# Copy application files
COPY src/ ./src/
COPY data/ ./data/
COPY resources/ ./resources/
COPY models/ ./models/
COPY reports/ ./reports/
# Create required directories
RUN mkdir -p /app/reports /app/models /app/resources/cache
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# Default: SSE transport on 0.0.0.0:8000 (override via env or CLI)
ENV MCP_TRANSPORT=sse
ENV MCP_HOST=0.0.0.0
ENV MCP_PORT=8000
EXPOSE 8000
# Health check (verify imports work)
RUN python -c "from src.machinery_diagnostics_server import mcp; print('Server imports OK')"
ENTRYPOINT ["predictive-maintenance-mcp"]