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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 52 additions and 23 deletions

4
.gitattributes vendored
View File

@ -1,4 +0,0 @@
*.mmdb filter=lfs diff=lfs merge=lfs -text
*.mo filter=lfs diff=lfs merge=lfs -text
*.ipdb filter=lfs diff=lfs merge=lfs -text
leak_passwords.db filter=lfs diff=lfs merge=lfs -text

3
.gitignore vendored
View File

@ -46,3 +46,6 @@ test.py
.test/ .test/
*.mo *.mo
apps.iml apps.iml
*.db
*.mmdb
*.ipdb

View File

@ -1,4 +1,4 @@
FROM jumpserver/core-base:20250418_040425 AS stage-build FROM jumpserver/core-base:20250427_062456 AS stage-build
ARG VERSION ARG VERSION

View File

@ -48,12 +48,14 @@ ENV LANG=en_US.UTF-8 \
ENV UV_LINK_MODE=copy ENV UV_LINK_MODE=copy
RUN --mount=type=cache,target=/root/.cache \ RUN --mount=type=cache,target=/root/.cache \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \ --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
--mount=type=bind,source=utils/clean_site_packages.sh,target=clean_site_packages.sh \ --mount=type=bind,source=requirements/clean_site_packages.sh,target=clean_site_packages.sh \
--mount=type=bind,source=requirements/collections.yml,target=collections.yml \ --mount=type=bind,source=requirements/collections.yml,target=collections.yml \
--mount=type=bind,source=requirements/static_files.sh,target=utils/static_files.sh \
set -ex \ set -ex \
&& uv venv \ && uv venv \
&& uv pip install -i${PIP_MIRROR} -r pyproject.toml \ && uv pip install -i${PIP_MIRROR} -r pyproject.toml \
&& ln -sf $(pwd)/.venv /opt/py3 && ln -sf $(pwd)/.venv /opt/py3 \
&& bash utils/static_files.sh \
&& bash clean_site_packages.sh

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a2805a0264fc07ae597704841ab060edef8bf74654f525bc778cb9195d8cad0e
size 2547712

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:860b4d38beff81667c64da41c026a7dd28c3c93a28ae61fefaa7c26875f35638
size 73906864

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c5119fd8911a107a7112422ade326766fe3d9538ac15bca06e3c622191c84e18
size 61086554

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b82b874152c798dda407ffe7544e1f5ec67efa1f5c334efc0d3893b8053b4be1
size 3649897

View File

@ -2,6 +2,11 @@
lib_path="/opt/py3/lib/python3.11/site-packages" 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" need_clean="jedi"
for i in $need_clean; do for i in $need_clean; do

View File

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