Skip to content

Commit 861fd03

Browse files
jefcodercforge42
authored andcommitted
Dockerfile working with venv-uv
1 parent c7ec6fe commit 861fd03

File tree

2 files changed

+44
-14
lines changed

2 files changed

+44
-14
lines changed

Dockerfile

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,48 @@
1-
# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
21
# Start with a Node.js base image
32
FROM node:18-alpine AS builder
4-
53
# Create a directory for the app
64
WORKDIR /app
7-
85
# Copy package.json and package-lock.json for installing dependencies
96
COPY package.json package-lock.json ./
10-
117
# Install dependencies
128
RUN npm install --ignore-scripts
13-
149
# Copy the rest of the application source code
1510
COPY . .
16-
1711
# Build the project
1812
RUN npm run build
1913

2014
# Use the same Node.js base image for the final container
2115
FROM node:18-alpine
22-
2316
# Set the working directory
2417
WORKDIR /app
25-
2618
# Copy the build output and necessary files from the builder stage
2719
COPY --from=builder /app/build /app/build
2820
COPY --from=builder /app/package.json /app/package.json
2921
COPY --from=builder /app/package-lock.json /app/package-lock.json
22+
COPY --from=builder /app/node_modules /app/node_modules
23+
24+
# Install Python and required tools
25+
RUN apk add --no-cache python3 py3-pip curl bash
26+
27+
# Download and install uv using the official installer
28+
ADD https://astral.sh/uv/install.sh /uv-installer.sh
29+
RUN sh /uv-installer.sh && rm /uv-installer.sh
30+
31+
# Ensure the installed binary is on the PATH
32+
ENV PATH="/root/.local/bin:$PATH"
33+
34+
# Create required directories
35+
RUN mkdir -p /app/generated_code
36+
RUN mkdir -p /app/.venvs/ai
3037

31-
# Install only production dependencies
32-
RUN npm ci --omit=dev
38+
# Create a virtual environment
39+
RUN uv venv /app/.venvs/ai
3340

34-
# Set the environment variables for the Conda environment
35-
ENV CODE_STORAGE_DIR=/path/to/code/storage
36-
ENV CONDA_ENV_NAME=your-conda-env
41+
# Set the environment variables
42+
ENV CODE_STORAGE_DIR=/app/generated_code
43+
ENV ENV_TYPE=venv-uv
44+
ENV UV_VENV_PATH=/app/.venvs/ai
45+
ENV PATH="/app/.venvs/ai/bin:$PATH"
3746

3847
# Specify the command to run the MCP Code Executor server
3948
ENTRYPOINT ["node", "build/index.js"]

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ npm run build
5252

5353
To configure the MCP Code Executor server, add the following to your MCP servers configuration file:
5454

55+
### Using Node.js
56+
5557
```json
5658
{
5759
"mcpServers": {
@@ -70,6 +72,26 @@ To configure the MCP Code Executor server, add the following to your MCP servers
7072
}
7173
```
7274

75+
### Using Docker
76+
77+
```json
78+
{
79+
"mcpServers": {
80+
"mcp-code-executor": {
81+
"command": "docker",
82+
"args": [
83+
"run",
84+
"-i",
85+
"--rm",
86+
"mcp-code-executor"
87+
]
88+
}
89+
}
90+
}
91+
```
92+
93+
> **Note:** The Dockerfile has been tested with the venv-uv environment type only. Other environment types may require additional configuration.
94+
7395
### Environment Variables
7496

7597
#### Required Variables
@@ -164,4 +186,3 @@ Contributions are welcome! Please open an issue or submit a pull request.
164186
## License
165187

166188
This project is licensed under the MIT License.
167-

0 commit comments

Comments
 (0)