From 5277156d18b65083a5395c4ae383e70fd2d547e2 Mon Sep 17 00:00:00 2001 From: Assad Yousuf Date: Wed, 6 Aug 2025 13:23:26 -0700 Subject: [PATCH] Dockerise MCP-run-python server + add git workflows to publish images on new releases --- .github/workflows/mcp-python-release.yml | 54 ++++++++++++++++++++++++ mcp-run-python/Dockerfile | 22 ++++++++++ 2 files changed, 76 insertions(+) create mode 100644 .github/workflows/mcp-python-release.yml create mode 100644 mcp-run-python/Dockerfile diff --git a/.github/workflows/mcp-python-release.yml b/.github/workflows/mcp-python-release.yml new file mode 100644 index 000000000..865c930cb --- /dev/null +++ b/.github/workflows/mcp-python-release.yml @@ -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 diff --git a/mcp-run-python/Dockerfile b/mcp-run-python/Dockerfile new file mode 100644 index 000000000..d5b46da0c --- /dev/null +++ b/mcp-run-python/Dockerfile @@ -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" +]