sync_llm_images.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/bin/bash
  2. # 用法:
  3. # ./sync-images.sh <targetRegistry>
  4. # 示例:
  5. # ./sync-images.sh crpi-nf3abu98o8qf9y2x.cn-beijing.personal.cr.aliyuncs.com/eikoh
  6. set -euo pipefail
  7. if [ $# -ne 1 ]; then
  8. echo "用法: $0 <targetRegistry>"
  9. echo "例如: $0 registry.cn-beijing.aliyuncs.com/cloudpods"
  10. exit 1
  11. fi
  12. TARGET_REGISTRY="$1"
  13. SOURCE_REGISTRY="${SOURCE_REGISTRY:-docker.io}"
  14. # ----------------------------
  15. # 要同步的镜像列表
  16. # ----------------------------
  17. IMAGES=(
  18. # "nginx:latest"
  19. # "redis:6-alpine"
  20. # "postgres:15-alpine"
  21. # "langgenius/dify-api:1.7.2"
  22. # "langgenius/dify-sandbox:0.2.12"
  23. # "langgenius/dify-plugin-daemon:0.2.0-local"
  24. # "langgenius/dify-web:1.7.2"
  25. # "ubuntu/squid:latest"
  26. # "semitechnologies/weaviate:1.19.0"
  27. # "ollama/ollama:0.15.1"
  28. # "vllm/vllm-openai:v0.15.1"
  29. # "yanwk/comfyui-boot:cu128-slim"
  30. # "node:22-bookworm"
  31. # "coollabsio/openclaw:latest"
  32. # "coollabsio/openclaw-browser:latest"
  33. # ghcr.io/coollabsio/openclaw-base:latest
  34. # lscr.io/linuxserver/webtop:ubuntu-xfce
  35. registry.cn-beijing.aliyuncs.com/zexi/openclaw:v2026.3.12-20260326.2
  36. )
  37. for image in "${IMAGES[@]}"; do
  38. # 拆分 name 和 tag
  39. if [[ "$image" == *":"* ]]; then
  40. name="${image%%:*}" # 冒号前
  41. tag="${image##*:}" # 冒号后
  42. else
  43. name="$image"
  44. tag="latest"
  45. fi
  46. short_name="${name##*/}" # 目标镜像只取最后一级名字
  47. # 如果 name 已经包含 registry(例如 ghcr.io/xxx 或 localhost:5000/xxx),就不要再前缀 docker.io
  48. first_component="${name%%/*}"
  49. if [[ "$name" == */* ]] && { [[ "$first_component" == *.* ]] || [[ "$first_component" == *:* ]] || [[ "$first_component" == "localhost" ]]; }; then
  50. SRC="docker://${name}:${tag}"
  51. else
  52. SRC="docker://${SOURCE_REGISTRY}/${name}:${tag}"
  53. fi
  54. DST="docker://${TARGET_REGISTRY}/${short_name}:${tag}"
  55. echo
  56. echo "Sync dify image"
  57. echo " Source: ${SRC}"
  58. echo " Target: ${DST}"
  59. echo
  60. skopeo copy --override-os linux --multi-arch all "${SRC}" "${DST}"
  61. echo "Completed: ${short_name}:${tag}"
  62. done
  63. echo "All images sync completed"