Skip to content

Multi architecture docker build for Glean MCP #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

aaronsb
Copy link

@aaronsb aaronsb commented Mar 26, 2025

Add Multi-Architecture Docker Build Support

Overview

This pull request adds support for building Docker images for multiple CPU architectures (amd64 and arm64) both locally and via GitHub Actions. This enhancement improves compatibility across different platforms and deployment environments. When users want to use the Glean MCP server, many different possible MCP capable tool hosts are able to use dockerized images. This prevents errors and difficulties with deploying the MCP server, and sets the roadway for more enhancements to this MCP server.

Changes

GitHub Actions Workflow

  • Added a new GitHub Actions workflow for Docker builds (docker-build.yml)
  • Configured the workflow to build and push multi-architecture images to GitHub Container Registry
  • Set up automated cleanup of old container versions
  • Implemented proper tagging strategy for releases and branches

Local Build Improvements

  • Enhanced build scripts to support multi-architecture builds
  • Added QEMU support for cross-platform builds
  • Updated Docker configuration for better compatibility with different architectures
  • Improved Docker build process with proper caching and optimization

Docker Configuration

  • Updated Dockerfile for multi-architecture compatibility
  • Configured proper build arguments and environment variables
  • Ensured consistent behavior across different platforms

Benefits

  • Improved Compatibility: Support for both amd64 (x86_64) and arm64 (Apple Silicon, AWS Graviton, etc.) architectures
  • Simplified Deployment: Single image manifest that works across different CPU architectures
  • Better Developer Experience: Consistent build process regardless of local development environment
  • Reduced Resource Usage: Optimized build process with proper caching
  • Automated Workflows: Streamlined CI/CD process for Docker image builds
  • Simplified MCP Server Usage: Docker images provide a far simpler way to run Glean MCP on agent hosts that can use MCP servers, eliminating complex setup procedures and dependency management

Testing

  • Verified local multi-architecture builds on different platforms
  • Tested GitHub Actions workflow for proper image building and pushing
  • Confirmed compatibility with both amd64 and arm64 environments
  • Validated Docker image functionality across different architectures

Notes for Reviewers

  • The GitHub Actions workflow is configured to push to the GitHub Container Registry (ghcr.io)
  • The workflow runs on pushes to main, tags starting with 'v', and pull requests to main
  • Local build scripts can be used for testing without pushing to a registry

Deployment Examples

Running the MCP Server with Docker

# Pull the multi-architecture image (automatically selects the right architecture)
docker pull ghcr.io/gleanwork/mcp-server:latest

# Run the MCP server
docker run -p 3000:3000 ghcr.io/gleanwork/mcp-server:latest

Using in Agent Configurations

{
  "mcpServers": {
    "glean": {
      "command": "docker",
      "args": ["run", "--rm", "-i", "ghcr.io/gleanwork/mcp-server:latest"],
      "env": {
        "API_KEY": "your-api-key"
      }
    }
  }
}

This containerized approach significantly simplifies deployment across different environments and architectures without requiring manual setup of Node.js, dependencies, or build tools on the host system.

aaronsb added 7 commits March 26, 2025 15:50
- Created build-local.sh script with improved error handling and output management
- Fixed ES module compatibility issues in package.json
- Updated Dockerfile to use npm instead of pnpm
- Updated GitHub Actions workflow to push to ghcr.io/aaronsb/glean-mcp-server
- Updated documentation in README.md
I missed a few urls. sorry about that!
@steve-calvert-glean steve-calvert-glean self-requested a review March 30, 2025 19:41
@steve-calvert-glean steve-calvert-glean added the enhancement New feature or request label Mar 30, 2025
@steve-calvert-glean
Copy link
Collaborator

Thanks for this change, @aaronsb! It looks like CI is failing. I'll try to take a peek at this and resolve unless you have a chance before me.

@steve-calvert-glean
Copy link
Collaborator

@aaronsb I've fixed the CI issue (was the result of pnpm@10 restricting builds on package installs). This branch just needs a rebase (and the merge conflict needs fixing, likely due to my running npx sort-package-json).

@aaronsb
Copy link
Author

aaronsb commented Mar 31, 2025

Cool - I made sure it would build on my fork but I've probably got different rules set up. Let me know if you have any other questions on rebase or ci.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants