Skip to content

Add GitHub Actions workflow to build the docker image #2

@akolotov

Description

@akolotov

The GitHub actions to build a docker image will allow to keep the MCP server docker image on GitHub registry so the end user don't need to clone repo and keep local Python environment to run the MCP server.

Create the file .github/workflows/main.yml with the following content:

name: Build CodeAlive MCP Server docker image

on:
  push:

env:
  DOCKER_REGISTRY: ghcr.io
  DOCKER_USERNAME: ${{ github.actor }}
  DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
  IMAGE_NAME: ghcr.io/codealive-ai/codealive-mcp

jobs:
  build-mcp-server:
    name: MCP Server docker image
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write
    steps:
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      - name: Docker meta
        id: meta
        uses: docker/metadata-action@v3
        with:
          images: ${{ env.IMAGE_NAME }}
      - name: Login to GitHub Container Registry
        uses: docker/login-action@v2
        with:
          registry: ${{ env.DOCKER_REGISTRY }}
          username: ${{ env.DOCKER_USERNAME }}
          password: ${{ env.DOCKER_PASSWORD }}
      - name: Build and push
        uses: docker/build-push-action@v3
        with:
          push: true
          platforms: linux/amd64,linux/arm64
          file: ./Dockerfile
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          cache-from: type=gha
          cache-to: type=gha

In this case instructions to configure MCP server in README.md fie could contain an example how add the server in an app serving as the MCP host. For example, for Claude Desktop the configuration of the server could be like this:

{
  "mcpServers": {
    "codealive": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-I",
        "-e CODEALIVE_API_KEY=YOUR_API_KEY_HERE",
        "ghcr.io/codealive-ai/codealive-mcp:latest" (or `main` if the releases are not published)
      ]
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions