Skip to content

Commit 5871ffe

Browse files
stack72claude
andauthored
feat: add multi-arch Docker image build to release pipeline (#882)
Build and push linux/amd64 and linux/arm64 Docker images to DockerHub (systeminit/swamp) on each release, using pre-compiled binaries from the GitHub Release. Based on denoland/deno for Deno runtime support. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2ba73ef commit 5871ffe

2 files changed

Lines changed: 74 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,72 @@ jobs:
163163
repository: systeminit/swamp-uat
164164
event-type: run-uat
165165
client-payload: '{"version": "${{ steps.version.outputs.version }}"}'
166+
167+
docker:
168+
name: Build and Push Docker Image
169+
runs-on: ubuntu-latest
170+
needs: release
171+
permissions:
172+
contents: read
173+
174+
steps:
175+
- name: Checkout code
176+
uses: actions/checkout@v4
177+
with:
178+
ref: main
179+
180+
- name: Download Linux binaries from release
181+
env:
182+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
183+
run: |
184+
mkdir -p docker-build/linux-amd64 docker-build/linux-arm64
185+
# Find the release tag (use latest release since we just created it)
186+
LATEST_TAG=$(gh release view --json tagName -q .tagName)
187+
echo "Downloading binaries from release ${LATEST_TAG}"
188+
gh release download "${LATEST_TAG}" --pattern "swamp-linux-x86_64" --dir docker-build/linux-amd64
189+
gh release download "${LATEST_TAG}" --pattern "swamp-linux-aarch64" --dir docker-build/linux-arm64
190+
mv docker-build/linux-amd64/swamp-linux-x86_64 docker-build/linux-amd64/swamp
191+
mv docker-build/linux-arm64/swamp-linux-aarch64 docker-build/linux-arm64/swamp
192+
chmod +x docker-build/linux-amd64/swamp docker-build/linux-arm64/swamp
193+
# Extract version from tag for Docker tagging
194+
echo "docker_tag=${LATEST_TAG#v}" >> "$GITHUB_ENV"
195+
196+
- name: Set up QEMU
197+
uses: docker/setup-qemu-action@v3
198+
199+
- name: Set up Docker Buildx
200+
uses: docker/setup-buildx-action@v3
201+
202+
- name: Login to Docker Hub
203+
uses: docker/login-action@v3
204+
with:
205+
username: ${{ secrets.DOCKERHUB_USERNAME }}
206+
password: ${{ secrets.DOCKERHUB_TOKEN }}
207+
208+
- name: Copy Dockerfile into build contexts
209+
run: |
210+
cp Dockerfile docker-build/linux-amd64/
211+
cp Dockerfile docker-build/linux-arm64/
212+
213+
- name: Build and push (amd64)
214+
uses: docker/build-push-action@v6
215+
with:
216+
context: docker-build/linux-amd64
217+
platforms: linux/amd64
218+
push: true
219+
tags: systeminit/swamp:${{ env.docker_tag }}-amd64
220+
221+
- name: Build and push (arm64)
222+
uses: docker/build-push-action@v6
223+
with:
224+
context: docker-build/linux-arm64
225+
platforms: linux/arm64
226+
push: true
227+
tags: systeminit/swamp:${{ env.docker_tag }}-arm64
228+
229+
- name: Create and push multi-arch manifest
230+
run: |
231+
docker buildx imagetools create \
232+
-t systeminit/swamp:${{ env.docker_tag }} \
233+
systeminit/swamp:${{ env.docker_tag }}-amd64 \
234+
systeminit/swamp:${{ env.docker_tag }}-arm64

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM denoland/deno:latest
2+
COPY swamp /usr/local/bin/swamp
3+
RUN chmod +x /usr/local/bin/swamp
4+
WORKDIR /workspace
5+
ENTRYPOINT ["swamp"]

0 commit comments

Comments
 (0)