-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathDockerfile
57 lines (43 loc) · 1.93 KB
/
Dockerfile
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
# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Start from a Python base image with the necessary tools
FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim AS uv
# Set the working directory in the container
WORKDIR /app
# Copy the project's pyproject.toml and lock file for dependency installation
COPY pyproject.toml /app/
COPY uv.lock /app/
COPY README.md /app/
# Enable bytecode compilation and set link mode to copy for dependencies
ENV UV_COMPILE_BYTECODE=1
ENV UV_LINK_MODE=copy
# Install dependencies including git
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
# Install dependencies
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-install-project --no-dev --no-editable
# Copy the entire project into the container
COPY src /app/src
# Check if src/mcp_wcgw_fork is empty and clone the repository if needed
RUN if [ ! -d "/app/src/mcp_wcgw_fork" ] || [ -z "$(ls -A /app/src/mcp_wcgw_fork)" ]; then \
mkdir -p /app/src/mcp_wcgw_fork && \
git clone https://github.com/rusiaaman/python-sdk.git /app/src/mcp_wcgw_fork && \
echo "Repository cloned successfully"; \
else \
echo "src/mcp_wcgw_fork already exists and is not empty"; \
fi
# Install the project
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev --no-editable
# Use a smaller image to run the application
FROM python:3.12-slim-bookworm
RUN apt-get update && apt-get install -y screen && rm -rf /var/lib/apt/lists/*
# Set the working directory in the container
WORKDIR /workspace
# Copy the installed application from the previous stage
COPY --from=uv --chown=app:app /app/.venv /app/.venv
# Copy the cloned repository if it exists
COPY --from=uv --chown=app:app /app/src/mcp_wcgw_fork /app/src/mcp_wcgw_fork
# Add the virtual environment to the PATH
ENV PATH="/app/.venv/bin:$PATH"
# Specify the command to run on container start
ENTRYPOINT ["wcgw_mcp"]