-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (22 loc) · 931 Bytes
/
Dockerfile
File metadata and controls
32 lines (22 loc) · 931 Bytes
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
FROM python:3.12-alpine
# Install system dependencies
RUN apk add --no-cache curl
# Install uv from official image (supports multi-arch)
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# Set working directory
WORKDIR /app
# Copy dependency files first for better caching
COPY pyproject.toml uv.lock ./
# Install dependencies first (this layer will be cached if dependencies don't change)
RUN uv sync --frozen --no-install-project
# Copy the rest of the project files
COPY . /app
# Install the project itself (this will be much faster as dependencies are already installed)
RUN uv sync --frozen
# Create a non-root user
RUN adduser -D -u 1000 mcpuser && chown -R mcpuser:mcpuser /app
USER mcpuser
# Use virtual environment activation and direct Python execution
# Avoid "uv run" to prevent runtime project rebuilding and reduce startup overhead
ENTRYPOINT [".venv/bin/python", "-m", "modelscope_mcp_server"]
CMD []