Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions build/deployments/custom-container.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,43 @@ RUN npm run build
CMD ["node", "dist/index.js"]
```

```dockerfile Node.js/TypeScript (Monorepo with Turbo)
FROM node:22-slim

ARG TURBO_TEAM
ENV TURBO_TEAM=$TURBO_TEAM

ARG TURBO_TOKEN
ENV TURBO_TOKEN=$TURBO_TOKEN

# Set working directory
WORKDIR /app

# Copy root package.json and lockfile
COPY package*.json ./

# Copy turbo.json for build configuration
COPY turbo.json ./

# Copy shared packages (adjust paths as needed)
COPY packages/ ./packages/

# Copy the specific app
COPY apps/my-mcp-server/ ./apps/my-mcp-server/

# Install dependencies from monorepo root
RUN npm ci

# Build using Turborepo (builds dependencies in correct order)
RUN npx turbo build --filter=my-mcp-server

# Expose the port your app runs on
EXPOSE 8080

# Start the application from root directory to maintain module resolution
CMD ["node", "apps/my-mcp-server/dist/index.cjs"]
```

```dockerfile Python
FROM python:3.11-slim

Expand All @@ -129,6 +166,38 @@ CMD ["uv", "run", "python", "main.py"]

</CodeGroup>

## Monorepo Considerations

If you're working with a monorepo (using tools like Turbo, Lerna, or Nx), you'll need to adjust your configuration:

### smithery.yaml for Monorepo

For monorepos, you may need to specify a custom Docker build path that includes the entire repository context:

```yaml
runtime: "container"
build:
dockerfile: "apps/my-mcp-server/Dockerfile" # Path to your Dockerfile
dockerBuildPath: "../../" # Build from repository root
startCommand:
type: "http"
```

### Dockerfile Patterns

The monorepo Dockerfile example above shows the key patterns:

- **Copy the entire monorepo structure**: Include `packages/`, `apps/`, and root configuration files
- **Use Turbo build arguments**: Pass `TURBO_TEAM` and `TURBO_TOKEN` if using Turbo Cloud
- **Build with dependency awareness**: Use `npx turbo build --filter=your-app` to build only your app and its dependencies
- **Maintain module resolution**: Start the application from the root directory to preserve workspace module resolution

### Common Monorepo Issues

- **Build context**: Ensure your `dockerBuildPath` includes all necessary workspace dependencies
- **File copying**: Copy shared packages and configuration files before building
- **Module resolution**: Start your application from the correct working directory to maintain import paths

## Deploy

1. Push your code (including `smithery.yaml` and `Dockerfile`) to GitHub
Expand Down Expand Up @@ -157,6 +226,7 @@ Common deployment failures and solutions:

- **Docker build fails**: Check your Dockerfile syntax and ensure all files are copied correctly
- **Dependencies not found**: Make sure your package files are copied before installing dependencies
- **Monorepo build issues**: Ensure your `dockerBuildPath` includes the entire repository context and all workspace dependencies are copied correctly

### Why don't my server's capabilities get listed?

Expand Down