perf: change lfs files download (#15293)

* perf: change lfs files download

* perf: clean unused ansible module

* perf: update lfs download

* perf: Update Dockerfile with new base image tag

* perf: change download path

* perf: Update Dockerfile with new base image tag

---------

Co-authored-by: ibuler <ibuler@qq.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
fit2bot
2025-04-27 14:35:10 +08:00
committed by GitHub
parent 24fe058fd9
commit e992c44e11
11 changed files with 52 additions and 23 deletions

View File

@@ -0,0 +1,40 @@
#!/bin/bash
lib_path="/opt/py3/lib/python3.11/site-packages"
if [ ! -d "$lib_path" ]; then
echo "lib_path $lib_path not exist"
exit 0
fi
# 清理不需要的模块
need_clean="jedi"
for i in $need_clean; do
rm -rf "${lib_path}/${i}"
done
# 清理 ansible connection 中 不需要的模块
ansible_connection="${lib_path}/ansible_collections"
need_clean="fortinet dellemc f5networks netapp theforeman google azure cyberark ibm
netbox purestorage inspur netapp_eseries sensu check_point vyos arista"
for i in $need_clean; do
echo "rm -rf ${ansible_connection:-tmp}/${i}"
rm -rf "${ansible_connection:-tmp}/${i}"
done
# 清理缓存文件
cd ${lib_path} || exit 1
find . -name "*.pyc" -exec rm -f {} \;
# 清理不需要的国际化文件
find . -name 'locale' -o -name 'locales' -type d | while read -r dir; do
find "$dir" -mindepth 1 -maxdepth 1 -type d \
! -name 'zh_Hans' \
! -name 'zh_Hant' \
! -name 'zh_CN' \
! -name 'en' \
! -name 'en_US' \
! -name 'ja' \
! -name 'fr' \
-exec rm -rf {} \;
done

View File

@@ -4,8 +4,7 @@ $ pip install cryptography --global-option=build_ext --global-option="-L/opt/hom
# Pillow zlib failed
Reinstall xcode reslove
# Reinstall xcode reslove
$ xcode-select --install
@@ -14,4 +13,4 @@ $ xcode-select --install
wget 'https://raw.githubusercontent.com/Homebrew/homebrew-core/7f35e6ede954326a10949891af2dba47bbe1fc17/Formula/libxmlsec1.rb'
brew install ./libxmlsec1.rb
# libxmlsec1
# libxmlsec1

View File

@@ -0,0 +1,36 @@
#!/bin/bash
CURRENT_DIR=$(cd "$(dirname "$0")" && pwd)
BASE_DIR=$(dirname "$CURRENT_DIR")
VERSION=v0.0.1
to_files="
apps/common/utils/ip/geoip/GeoLite2-City.mmdb
apps/common/utils/ip/ipip/ipipfree.ipdb
apps/accounts/automations/check_account/leak_passwords.db
"
if [[ $1 == "root" ]];then
BASE_DIR="${BASE_DIR}/jumpserver"
fi
for file in $to_files; do
# Check if the file already exists
file_path="${BASE_DIR}/$file"
rm -f $file_path
if [ -f "$file_path" ]; then
echo "File $file already exists, skipping download."
continue
fi
filename=$(basename "$file")
to_dir=$(dirname "$file_path")
if [ ! -d "$to_dir" ]; then
mkdir -p "$to_dir"
fi
url=""https://github.com/jumpserver/static/releases/download/${VERSION}/$filename""
echo "Download $filename to $file_path"
wget "$url" -O "${file_path}"
done