Skip to content

Commit a6ac0af

Browse files
committed
chore: update Dockerfile to improve startup speed
1 parent a5df98b commit a6ac0af

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

Dockerfile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,24 @@ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
99
# Set working directory
1010
WORKDIR /app
1111

12-
# Copy project files
12+
# Copy dependency files first for better caching
13+
COPY pyproject.toml uv.lock ./
14+
15+
# Install dependencies first (this layer will be cached if dependencies don't change)
16+
RUN uv sync --frozen --no-install-project
17+
18+
# Copy the rest of the project files
1319
COPY . /app
1420

15-
# Sync dependencies and install project
21+
# Install the project itself (this will be much faster as dependencies are already installed)
1622
RUN uv sync --frozen
1723

1824
# Create a non-root user
1925
RUN adduser -D -u 1000 mcpuser && chown -R mcpuser:mcpuser /app
2026
USER mcpuser
2127

22-
# Set entrypoint and default arguments
23-
ENTRYPOINT ["uv", "run", "modelscope-mcp-server"]
28+
# Use virtual environment activation and direct Python execution
29+
# Avoid "uv run" to prevent runtime project rebuilding and reduce startup overhead
30+
ENTRYPOINT [".venv/bin/python", "-m", "modelscope_mcp_server"]
31+
2432
CMD []
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Version information for ModelScope MCP Server."""
22

3-
__version__ = "0.1.4"
3+
__version__ = "0.1.5.dev1"

0 commit comments

Comments
 (0)