Skip to content

Commit 6e8ea36

Browse files
committed
feat(ci): add ARMv7 architecture support for Docker builds
1 parent 69110f7 commit 6e8ea36

1 file changed

Lines changed: 47 additions & 2 deletions

File tree

.github/workflows/build-dockerhub.yml

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,53 @@ jobs:
220220
cache-from: type=gha,scope=subconverter
221221
cache-to: type=gha,mode=max,scope=subconverter
222222

223+
build-armv7:
224+
runs-on: ubuntu-24.04-arm # 在 ARM64 Runner 上模拟 ARMv7,效率远高于 x86 模拟
225+
needs: prepare
226+
if: needs.prepare.outputs.is_release == 'true'
227+
outputs:
228+
digest: ${{ steps.build_image.outputs.digest }}
229+
steps:
230+
- name: Checkout
231+
uses: actions/checkout@v6
232+
with:
233+
token: ${{ secrets.PAT_TOKEN }}
234+
fetch-depth: 0
235+
236+
- name: Set up QEMU
237+
uses: docker/setup-qemu-action@v3
238+
with:
239+
platforms: arm # 仅安装 ARMv7 模拟器
240+
241+
- name: Set up Docker Buildx
242+
uses: docker/setup-buildx-action@v3
243+
244+
- name: Log in to Docker Hub
245+
if: github.event_name != 'pull_request'
246+
uses: docker/login-action@v3
247+
with:
248+
username: ${{ secrets.DOCKERHUB_USERNAME }}
249+
password: ${{ secrets.DOCKERHUB_TOKEN }}
250+
251+
- name: Build and push final image
252+
id: build_image
253+
uses: docker/build-push-action@v6
254+
with:
255+
context: .
256+
file: ./Dockerfile
257+
push: ${{ github.event_name != 'pull_request' }}
258+
platforms: linux/arm/v7
259+
tags: ${{ needs.prepare.outputs.tags }}
260+
build-args: |
261+
THREADS=2
262+
SHA=${{ needs.prepare.outputs.sha_short }}
263+
VERSION=${{ needs.prepare.outputs.version }}
264+
cache-from: type=gha,scope=subconverter-armv7
265+
cache-to: type=gha,mode=max,scope=subconverter-armv7
266+
223267
merge-manifest:
224268
runs-on: ubuntu-latest
225-
needs: [prepare, build-amd64, build-arm64]
269+
needs: [prepare, build-amd64, build-arm64, build-armv7]
226270
if: needs.prepare.outputs.is_release == 'true' && github.event_name != 'pull_request'
227271
steps:
228272
- name: Set up Docker Buildx
@@ -243,6 +287,7 @@ jobs:
243287
docker buildx imagetools create \
244288
-t "$TAG" \
245289
"${IMAGE_NAME}@${{ needs.build-amd64.outputs.digest }}" \
246-
"${IMAGE_NAME}@${{ needs.build-arm64.outputs.digest }}"
290+
"${IMAGE_NAME}@${{ needs.build-arm64.outputs.digest }}" \
291+
"${IMAGE_NAME}@${{ needs.build-armv7.outputs.digest }}"
247292
done
248293

0 commit comments

Comments
 (0)