Skip to content

feat(docker): Add dockerfile to run MCP with supergateway#2

Merged
LMarkie merged 3 commits intomainfrom
supergateway-docker
Jun 23, 2025
Merged

feat(docker): Add dockerfile to run MCP with supergateway#2
LMarkie merged 3 commits intomainfrom
supergateway-docker

Conversation

@LMarkie
Copy link

@LMarkie LMarkie commented Jun 23, 2025

Fixes

Summary

Changes

Please provide a summary of what's being changed

User experience

Please share what the user experience looks like before and after this change

Checklist

If your change doesn't seem to apply, please leave them unchecked.

  • I have reviewed the contributing guidelines
  • I have performed a self-review of this change
  • Changes have been tested
  • Changes are documented

Is this a breaking change? (Y/N)

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

Comment on lines +10 to +48
runs-on: ubuntu-latest

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

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: opentrace/eks-mcp-server
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=ref,event=branch

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./src/eks-mcp-server
file: ./src/eks-mcp-server/Dockerfile.supergateway
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max No newline at end of file

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 9 months ago

To fix the issue, add a permissions block at the root of the workflow file. This block will define the minimal permissions required for the workflow to function. Based on the provided workflow, the contents: read permission is sufficient for most steps, while the packages: write permission is required for pushing Docker images to DockerHub.

The permissions block should be added immediately after the name field in the workflow file.


Suggested changeset 1
.github/workflows/docker.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -1,2 +1,5 @@
 name: Build and Publish EKS MCP Docker Image
+permissions:
+  contents: read
+  packages: write
 
EOF
@@ -1,2 +1,5 @@
name: Build and Publish EKS MCP Docker Image
permissions:
contents: read
packages: write

Copilot is powered by AI and may make mistakes. Always verify output.
@@ -0,0 +1,48 @@
name: Build and Publish EKS MCP Docker Image

Check failure

Code scanning / checkov

Ensure top-level permissions are not set to write-all Error

Ensure top-level permissions are not set to write-all
Comment on lines +1 to +42
FROM node:20-alpine

# Install supergateway
RUN npm install -g supergateway

# Install Python and uv
RUN apk add --no-cache python3 py3-pip
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

# Set up the EKS MCP server
WORKDIR /app

# Copy package metadata files first (for better layer caching)
COPY pyproject.toml uv.lock README.md LICENSE NOTICE ./

# Install dependencies
RUN uv sync --frozen --no-install-project --no-dev --no-editable

# Copy source code
COPY awslabs/ ./awslabs/

# Install the local package
RUN uv sync --frozen --no-dev --no-editable

# Set environment variables
ENV PYTHONPATH=/app
ENV PATH="/app/.venv/bin:$PATH"

# Configurable environment variables (secure defaults)
ENV SUPERGATEWAY_PORT=8000
ENV MCP_ALLOW_WRITE=false
ENV MCP_ALLOW_SENSITIVE_DATA=false

# Expose port
EXPOSE 8000

# Copy startup script
COPY docker-start.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-start.sh

# Use supergateway as entrypoint
ENTRYPOINT ["docker-start.sh"] No newline at end of file

Check failure

Code scanning / checkov

Ensure that HEALTHCHECK instructions have been added to container images Error

Ensure that HEALTHCHECK instructions have been added to container images
Comment on lines +1 to +42
FROM node:20-alpine

# Install supergateway
RUN npm install -g supergateway

# Install Python and uv
RUN apk add --no-cache python3 py3-pip
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/

# Set up the EKS MCP server
WORKDIR /app

# Copy package metadata files first (for better layer caching)
COPY pyproject.toml uv.lock README.md LICENSE NOTICE ./

# Install dependencies
RUN uv sync --frozen --no-install-project --no-dev --no-editable

# Copy source code
COPY awslabs/ ./awslabs/

# Install the local package
RUN uv sync --frozen --no-dev --no-editable

# Set environment variables
ENV PYTHONPATH=/app
ENV PATH="/app/.venv/bin:$PATH"

# Configurable environment variables (secure defaults)
ENV SUPERGATEWAY_PORT=8000
ENV MCP_ALLOW_WRITE=false
ENV MCP_ALLOW_SENSITIVE_DATA=false

# Expose port
EXPOSE 8000

# Copy startup script
COPY docker-start.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-start.sh

# Use supergateway as entrypoint
ENTRYPOINT ["docker-start.sh"] No newline at end of file

Check failure

Code scanning / checkov

Ensure that a user for the container has been created Error

Ensure that a user for the container has been created
@LMarkie LMarkie merged commit 0631242 into main Jun 23, 2025
4 checks passed
@LMarkie LMarkie deleted the supergateway-docker branch June 23, 2025 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant