|
1 | | -# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile |
2 | 1 | # Start with a Node.js base image |
3 | 2 | FROM node:18-alpine AS builder |
4 | | - |
5 | 3 | # Create a directory for the app |
6 | 4 | WORKDIR /app |
7 | | - |
8 | 5 | # Copy package.json and package-lock.json for installing dependencies |
9 | 6 | COPY package.json package-lock.json ./ |
10 | | - |
11 | 7 | # Install dependencies |
12 | 8 | RUN npm install --ignore-scripts |
13 | | - |
14 | 9 | # Copy the rest of the application source code |
15 | 10 | COPY . . |
16 | | - |
17 | 11 | # Build the project |
18 | 12 | RUN npm run build |
19 | 13 |
|
20 | 14 | # Use the same Node.js base image for the final container |
21 | 15 | FROM node:18-alpine |
22 | | - |
23 | 16 | # Set the working directory |
24 | 17 | WORKDIR /app |
25 | | - |
26 | 18 | # Copy the build output and necessary files from the builder stage |
27 | 19 | COPY --from=builder /app/build /app/build |
28 | 20 | COPY --from=builder /app/package.json /app/package.json |
29 | 21 | 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 |
30 | 37 |
|
31 | | -# Install only production dependencies |
32 | | -RUN npm ci --omit=dev |
| 38 | +# Create a virtual environment |
| 39 | +RUN uv venv /app/.venvs/ai |
33 | 40 |
|
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" |
37 | 46 |
|
38 | 47 | # Specify the command to run the MCP Code Executor server |
39 | 48 | ENTRYPOINT ["node", "build/index.js"] |
0 commit comments