Skip to content

Commit

Permalink
Feature(build): 🚀 支持多平台独立构建
Browse files Browse the repository at this point in the history
  • Loading branch information
a76yyyy committed Jan 31, 2025
1 parent d7d1e45 commit 192730c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
17 changes: 10 additions & 7 deletions .github/workflows/Build Image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ on:
jobs:
build:
runs-on: ubuntu-latest
name: Publish Package job
strategy:
matrix:
platform: [linux/arm64, linux/amd64, linux/arm/v6, linux/arm/v7, linux/ppc64le]
name: Publish Package job for ${{ matrix.platform }}

steps:
-
Expand All @@ -29,17 +32,17 @@ jobs:
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }} # dockerServer Username 在setting创建secrets name=DOCKER_USERNAME value=dockerid
password: ${{ secrets.GITHUB_TOKEN }} # dockerServer Token
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
-
id: login-dockerhub
name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }} # dockerServer Username 在setting创建secrets name=DOCKER_USERNAME value=dockerid
password: ${{ secrets.DOCKER_PASSWORD }} # dockerServer Token 在setting创建secrets name=DOCKER_PASSWORD value=dockerToken
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
continue-on-error: true
-
id: meta
Expand All @@ -54,10 +57,10 @@ jobs:
type=ref,event=tag
-
name: Publish Package
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: linux/arm64,linux/amd64,linux/arm/v6,linux/arm/v7,linux/ppc64le # 你准备构建的镜像平台
platforms: ${{ matrix.platform }}
push: true
tags: ${{ steps.meta.outputs.tags }}
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/reposi
&& mkdir -p /pkgs/apk \
&& echo 'builder ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \
&& echo "permit nopass :abuild" >> /etc/doas.d/doas.conf \
&& adduser -D -G abuild builder && su builder -c 'abuild-keygen -a -n -i'
&& adduser -D -G abuild builder \
&& su builder -c 'abuild-keygen -a -n -i'

COPY alpine/ /src/testing/onnxruntime
RUN chown -R builder /pkgs /src
Expand Down
8 changes: 4 additions & 4 deletions alpine/APKBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ options="net"

# tests fail on arm 32 bit, see https://github.com/microsoft/onnxruntime/issues/16387
case "$CARCH" in
armhf|armv7) options="!check $options"; _extra_cxxflags="-Wno-overflow"; _extra_cflags="-flto=auto";;
ppc64le) _extra_cflags="-fno-lto";;
*) _extra_cflags="-flto=auto";;
armhf|armv7) options="!check $options"; _extra_cxxflags="-Wno-overflow -flto=auto"; _extra_cflags="-flto=auto";;
ppc64le) _extra_cxxflags="-fno-lto"; _extra_cflags="-fno-lto";;
*) _extra_cxxflags="-flto=auto"; _extra_cflags="-flto=auto";;
esac

build() {
CFLAGS="$CFLAGS -O2 $_extra_cflags " \
CXXFLAGS="$CXXFLAGS $_extra_cxxflags -O2 -Wno-deprecated-declarations -Wno-error=template-id-cdtor -flto=auto -U_FORTIFY_SOURCE -Wno-unused-variable -Wno-unused-parameter" \
CXXFLAGS="$CXXFLAGS $_extra_cxxflags -O2 -Wno-deprecated-declarations -Wno-error=template-id-cdtor -U_FORTIFY_SOURCE -Wno-unused-variable -Wno-unused-parameter" \
LDFLAGS="$LDFLAGS -Wl,--copy-dt-needed-entries" \
cmake -S cmake -B build -G Ninja -Wno-dev \
-DCMAKE_BUILD_TYPE=None \
Expand Down

0 comments on commit 192730c

Please sign in to comment.