Skip to content

Commit e6f9f3d

Browse files
committed
feat: support multi-arch Docker image
1 parent 1de8394 commit e6f9f3d

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

.github/workflows/cd.yaml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,20 @@ on:
66

77
jobs:
88
docker-hub:
9-
name: Push Docker image to Docker Hub
9+
name: Push multi-arch Docker image to Docker Hub
1010
runs-on: ubuntu-latest
1111
permissions:
1212
contents: read
1313

1414
steps:
1515
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1616

17+
- name: Set up QEMU
18+
uses: docker/setup-qemu-action@4574d27a4764455b42196d70a065bc6853246a25 #v3.4.0
19+
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca #v3.9.0
22+
1723
- name: Log in to Docker Hub
1824
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
1925
with:
@@ -24,11 +30,14 @@ jobs:
2430
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
2531
with:
2632
context: .
33+
platforms: linux/amd64,linux/arm64
2734
push: true
2835
tags: "${{ github.repository }}:${{ github.event.release.tag_name }}-alpine"
36+
cache-from: type=gha
37+
cache-to: type=gha,mode=max
2938

3039
ghcr-io:
31-
name: Push Docker image to ghcr.io
40+
name: Push multi-arch Docker image to ghcr.io
3241
runs-on: ubuntu-latest
3342
permissions:
3443
contents: read
@@ -37,6 +46,12 @@ jobs:
3746
steps:
3847
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3948

49+
- name: Set up QEMU
50+
uses: docker/setup-qemu-action@4574d27a4764455b42196d70a065bc6853246a25 #v3.4.0
51+
52+
- name: Set up Docker Buildx
53+
uses: docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca #v3.9.0
54+
4055
- name: Log in to GHCR
4156
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
4257
with:
@@ -48,5 +63,8 @@ jobs:
4863
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
4964
with:
5065
context: .
66+
platforms: linux/amd64,linux/arm64
5167
push: true
5268
tags: "ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}-alpine"
69+
cache-from: type=gha
70+
cache-to: type=gha,mode=max

.github/workflows/ci.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,18 @@ jobs:
112112
needs: [lint, coverage, mypy]
113113
steps:
114114
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
115+
116+
- name: Set up QEMU
117+
uses: docker/setup-qemu-action@4574d27a4764455b42196d70a065bc6853246a25 #v3.4.0
118+
119+
- name: Set up Docker Buildx
120+
uses: docker/setup-buildx-action@f7ce87c1d6bead3e36075b2ce75da1f6cc28aaca #v3.9.0
121+
115122
- name: Build Docker image
116123
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v6.13.0
117124
with:
118125
context: .
126+
platforms: linux/amd64,linux/arm64
119127
push: false
120128
tags: "${{ github.repository }}:devel"
121129

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# Generated by https://smithery.ai. See: https://smithery.ai/docs/config#dockerfile
2-
# Use a Python image with uv pre-installed
3-
FROM ghcr.io/astral-sh/uv:python3.12-alpine AS uv
1+
# Build stage with explicit platform specification
2+
FROM --platform=$TARGETPLATFORM ghcr.io/astral-sh/uv:python3.12-alpine AS uv
43

54
# Install the project into /app
65
WORKDIR /app
@@ -23,7 +22,8 @@ ADD . /app
2322
RUN --mount=type=cache,target=/root/.cache/uv \
2423
uv sync --frozen --no-dev --no-editable
2524

26-
FROM python:3.12-alpine
25+
# Final stage with explicit platform specification
26+
FROM --platform=$TARGETPLATFORM python:3.12-alpine
2727

2828
LABEL org.opencontainers.image.source=https://github.com/sparfenyuk/mcp-proxy
2929
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."

0 commit comments

Comments
 (0)