From a2eec76e60f7316533063401031c337853e05271 Mon Sep 17 00:00:00 2001 From: Elvis Liao Date: Fri, 25 Jul 2025 13:45:14 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix(workflows):=20=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=8D=95=E5=BC=95=E5=8F=B7,=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6=E8=A2=AB=E8=A7=A3?= =?UTF-8?q?=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sync.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync.yaml b/.github/workflows/sync.yaml index 730c0cb..173ecf1 100644 --- a/.github/workflows/sync.yaml +++ b/.github/workflows/sync.yaml @@ -9,7 +9,7 @@ jobs: uses: actions/checkout@v4 - name: login to docker registry run: | - docker login -u "${{ secrets.DOCKER_USER }}" -p "${{ secrets.DOCKER_PWD }}" "${{ secrets.DOCKER_REGISTRY }}" + docker login -u "${{ secrets.DOCKER_USER }}" -p '${{ secrets.DOCKER_PWD }}' "${{ secrets.DOCKER_REGISTRY }}" - name: execute sync.sh run: | bash "${{ github.workspace }}/sync.sh" "${{ github.workspace }}/images.txt" "${{ secrets.DOCKER_REGISTRY }}" "${{ secrets.DOCKER_NS }}" From a5d8dd97b848dcd2b07d3f3658a16125b62e0e76 Mon Sep 17 00:00:00 2001 From: Elvis Liao Date: Fri, 25 Jul 2025 14:29:45 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=E8=AF=86=E5=88=AB=E5=B9=B6?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E5=AF=B9=E5=BA=94=E5=B9=B3=E5=8F=B0+?= =?UTF-8?q?=E6=9E=B6=E6=9E=84=E7=9A=84=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/docker_pull | 32 +++++++++++++++++++++++++++++++- sync.sh | 14 ++++++++++++-- 2 files changed, 43 insertions(+), 3 deletions(-) mode change 100644 => 100755 cmd/docker_pull diff --git a/cmd/docker_pull b/cmd/docker_pull old mode 100644 new mode 100755 index c096336..771fb92 --- a/cmd/docker_pull +++ b/cmd/docker_pull @@ -8,6 +8,36 @@ if [ ! -f "$CONFIG_FILE" ]; then exit 1 fi +# Get operating system type +OS=$(uname -s | tr '[:upper:]' '[:lower:]') +if [[ "$OS" == "darwin" ]]; then + OS="linux" # Docker Desktop on macOS runs Linux containers +fi + +# Get architecture +ARCH=$(uname -m) +case "$ARCH" in + x86_64) + ARCH="amd64" + ;; + aarch64|arm64) + ARCH="arm64" + ;; + armv7*) + ARCH="arm/v7" + ;; + armv6*) + ARCH="arm/v6" + ;; + i386|i686) + ARCH="386" + ;; + *) + # 保持原样 + ;; +esac +DOCKER_PLATFORM="$OS/$ARCH" + # Initialize variables REGISTRY_URL="" REGISTRY_NS="" @@ -83,7 +113,7 @@ popd > /dev/null # Write images.txt file echo "[record images] Writing tags to $IMAGES_DIR/images.txt" -printf "%s\n" "$@" > "$IMAGES_DIR/images.txt" +printf "%s --platform=$DOCKER_PLATFORM \n" "$@" > "$IMAGES_DIR/images.txt" # Execute git commit echo "[commit images] Start git commit:" diff --git a/sync.sh b/sync.sh index 06ec01f..6decf96 100644 --- a/sync.sh +++ b/sync.sh @@ -22,10 +22,20 @@ fi failed_count=0 failed_images="" -while IFS= read -r image; do +while IFS= read -r image_and_platform; do + # Check if platform information is present + if [[ "$image_and_platform" == *"--platform="* ]]; then + # Extract platform information and image name + image=$(echo "$image_and_platform" | sed -e "s/--platform=[^ ]*//g" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//') + platform_arg=$(echo "$image_and_platform" | grep -o -- "--platform=[^ ]*") + else + # No platform information + image="$image_and_platform" + platform_arg="" + fi # 拉取镜像 set +e - docker pull "$image" + docker pull "$image" $platform_arg pull_status=$? if [ $pull_status -ne 0 ]; then echo "Error: Failed to pull image $image, continuing..." From 817f1416fe570d2a22b2b2f69d044f48331cc935 Mon Sep 17 00:00:00 2001 From: Elvis Liao Date: Fri, 8 Aug 2025 16:24:12 +0800 Subject: [PATCH 3/3] refactor: add docker tags: node:lts --- images.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images.txt b/images.txt index 8b13789..ed31784 100644 --- a/images.txt +++ b/images.txt @@ -1 +1 @@ - +node:lts --platform=linux/arm64