feat: support multi-arch Docker image

This commit is contained in:
Sergey Parfenyuk
2025-02-07 20:44:18 +01:00
parent 1de8394767
commit e6f9f3db98
3 changed files with 32 additions and 6 deletions

View File

@@ -6,7 +6,7 @@ on:
jobs:
docker-hub:
name: Push Docker image to Docker Hub
name: Push multi-arch Docker image to Docker Hub
runs-on: ubuntu-latest
permissions:
contents: read
@@ -14,6 +14,12 @@ jobs:
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up QEMU
uses: docker/setup-qemu-action@4574d27a4764455b42196d70a065bc6853246a25 #v3.4.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca #v3.9.0
- name: Log in to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
@@ -24,11 +30,14 @@ jobs:
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: "${{ github.repository }}:${{ github.event.release.tag_name }}-alpine"
cache-from: type=gha
cache-to: type=gha,mode=max
ghcr-io:
name: Push Docker image to ghcr.io
name: Push multi-arch Docker image to ghcr.io
runs-on: ubuntu-latest
permissions:
contents: read
@@ -37,6 +46,12 @@ jobs:
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up QEMU
uses: docker/setup-qemu-action@4574d27a4764455b42196d70a065bc6853246a25 #v3.4.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca #v3.9.0
- name: Log in to GHCR
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
@@ -48,5 +63,8 @@ jobs:
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: "ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}-alpine"
cache-from: type=gha
cache-to: type=gha,mode=max

View File

@@ -112,10 +112,18 @@ jobs:
needs: [lint, coverage, mypy]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up QEMU
uses: docker/setup-qemu-action@4574d27a4764455b42196d70a065bc6853246a25 #v3.4.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca #v3.9.0
- name: Build Docker image
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
with:
context: .
platforms: linux/amd64,linux/arm64
push: false
tags: "${{ github.repository }}:devel"

View File

@@ -1,6 +1,5 @@
# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
# Use a Python image with uv pre-installed
FROM ghcr.io/astral-sh/uv:python3.12-alpine AS uv
# Build stage with explicit platform specification
FROM --platform=$TARGETPLATFORM ghcr.io/astral-sh/uv:python3.12-alpine AS uv
# Install the project into /app
WORKDIR /app
@@ -23,7 +22,8 @@ ADD . /app
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev --no-editable
FROM python:3.12-alpine
# Final stage with explicit platform specification
FROM --platform=$TARGETPLATFORM python:3.12-alpine
LABEL org.opencontainers.image.source=https://github.com/sparfenyuk/mcp-proxy
LABEL org.opencontainers.image.description="Connect to MCP servers that run on SSE transport, or expose stdio servers as an SSE server using the MCP Proxy server."