-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (29 loc) · 1.04 KB
/
Dockerfile
File metadata and controls
40 lines (29 loc) · 1.04 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
# Use Python slim image
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Set Python unbuffered mode for real-time logs
ENV PYTHONUNBUFFERED=1
# Copy pyproject.toml and README.md first for better caching
COPY pyproject.toml README.md ./
# Copy the source code
COPY src/ ./src/
# Install the package and its dependencies from pyproject.toml
RUN pip install --no-cache-dir .
# Create non-root user for security
RUN useradd -m -u 1000 mcpuser && \
chown -R mcpuser:mcpuser /app
# Switch to non-root user
USER mcpuser
# Environment variables for remote deployment
# MCP_TRANSPORT: "http" for remote, "stdio" for local (default)
# PORT: Server port (Render sets this automatically)
ENV MCP_TRANSPORT=http
ENV PORT=8000
# Expose the port
EXPOSE 8000
# Health check for container orchestration
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:${PORT}/health')" || exit 1
# Run the server
CMD ["python", "-m", "scrapegraph_mcp.server"]