Skip to content

Dockerise MCP-run-python server #2457

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
54 changes: 54 additions & 0 deletions .github/workflows/mcp-python-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Docker Release (mcp-run-python)

# Build and publish the MCP Run Python server Docker image to GHCR whenever a new
# git tag is pushed

on:
push:
tags:
- "v*"

permissions:
contents: read # allows reading from repo
packages: write # allows pushing to GHCR

jobs:
build-and-push:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up QEMU (multi-arch builds) # needed to build for both amd64 and arm64
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract version from tag
id: version
run: |
TAG="${GITHUB_REF#refs/tags/}"
# strip leading "v" if present so that image tags are like "0.0.15"
VERSION=${TAG#v}
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./mcp-run-python
file: ./mcp-run-python/Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/pydantic/mcp-run-python:${{ steps.version.outputs.version }}
ghcr.io/pydantic/mcp-run-python:latest
22 changes: 22 additions & 0 deletions mcp-run-python/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM denoland/deno:1.44.0

WORKDIR /app

COPY . .

RUN deno task build

RUN deno cache src/main.ts

EXPOSE 3001

CMD [
"deno", "run",
"-N",
"-R=node_modules",
"-W=node_modules",
"--node-modules-dir=auto",
"src/main.ts",
"sse",
"--port=3001"
]