add arm build

This commit is contained in:
somunslotus 2025-06-27 10:26:23 +08:00
parent 1e6d920c33
commit a86f4a563f
19 changed files with 346 additions and 1 deletions

Binary file not shown.

11
docker/Dockerfile.arm Normal file
View File

@ -0,0 +1,11 @@
FROM 172.20.32.187/pipeline-service/aimstack/aim:3.19.0-build-env
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
COPY aim*.whl /opt/aim/
RUN pip install /opt/aim/aim_ui-3.19.0-py3-none-any.whl
RUN pip install /opt/aim/aim-3.19.0-cp39-cp39-linux_aarch64.whl
WORKDIR /opt/aim
RUN aim init
ENTRYPOINT ["aim"]
CMD ["up"]

View File

@ -0,0 +1,41 @@
FROM ccr.ccs.tencentyun.com/somunslotus/python:3.9.10-slim-arm
# 替换 Debian 源为阿里云源
RUN sed -i.bak \
-e 's|http://[^/]*/debian|https://mirrors.aliyun.com/debian|g' \
-e 's|http://security.debian.org|https://mirrors.aliyun.com/debian-security|g' \
/etc/apt/sources.list && \
# 清空备份文件
rm -f /etc/apt/sources.list.bak
ENV HTTP_PROXY="http://172.20.32.253:3128" \
HTTPS_PROXY="http://172.20.32.253:3128" \
NO_PROXY="localhost,127.0.0.1" \
http_proxy="http://172.20.32.253:3128" \
https_proxy="http://172.20.32.253:3128" \
no_proxy="localhost,127.0.0.1"
# 更新并安装编译工具
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
build-essential \
gcc \
g++ \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# 设置工作目录
WORKDIR /app
# 设置 pip 清华源
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
# 预先复制 requirements 文件(利用缓存层)
COPY ./requirements-new.txt /app/
# 安装 Python 依赖
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements-new.txt

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,66 @@
#!/bin/bash
# 进入182服务器然后切换到conda activate aim-build环境进行构建
#构建aim 包
echo "build aim package success"
#编译前端代码
cd ../aim/web/ui
if [ -d build ]; then
echo "rm build dir success"
rm -rf build/
fi
if [ -d aim_ui/build ]; then
echo "rm aim_ui/build dir success"
rm -rf aim_ui/build/
fi
docker run -v $(pwd):/code -w /code \
-e http_proxy=http://172.20.32.253:3128 -e https_proxy=http://172.20.32.253:3128 \
ccr.ccs.tencentyun.com/somunslotus/node:18-alpine-arm /bin/sh -c "npm config set registry https://registry.npmmirror.com && npm install --legacy-peer-deps --verbose && npm run build"
if [ $? -ne 0 ]; then
echo "build ui failed"
exit 1
fi
mv -f build/ aim_ui/
echo "build ui success"
#构建aim-ui包
python setup.py bdist_wheel
if [ $? -ne 0 ]; then
echo "build aim-ui package failed"
exit 1
fi
cp dist/aim_ui*.whl ../../../docker/
echo "build aim-ui package success"
#取日期作为镜像的tag
cd ../../../docker/
date=$(date +%Y%m%d%H%M)
image=172.20.32.187/pipeline-service/aimstack/aim:3.19.0-$date-arm
docker build -t "$image" \
--build-arg "HTTP_PROXY=http://172.20.32.253:3128" \
--build-arg "HTTPS_PROXY=http://172.20.32.253:3128" \
-f Dockerfile.arm .
if [ $? -ne 0 ]; then
echo "build image failed"
exit 1
fi
echo "build image success"
docker push "$image"
if [ $? -ne 0 ]; then
echo "push image failed"
exit 1
fi
echo "build image success"

27
docker/arm-build-image.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash
date=$(date +%Y%m%d%H%M)
image=172.20.32.187/pipeline-service/aimstack/aim:3.19.0-$date-arm
docker build -t "$image" \
--build-arg "HTTP_PROXY=http://172.20.32.253:3128" \
--build-arg "HTTPS_PROXY=http://172.20.32.253:3128" \
-f Dockerfile.arm .
if [ $? -ne 0 ]; then
echo "build image failed"
exit 1
fi
echo "build image success"
docker push "$image"
if [ $? -ne 0 ]; then
echo "push image failed"
exit 1
fi
echo "build image success"

54
docker/arm-build-ui-whl.sh Executable file
View File

@ -0,0 +1,54 @@
#!/bin/bash
# 切换到项目 UI 目录
cd ../aim/web/ui || { echo "错误:无法切换到 aim/web/ui 目录"; exit 1; }
# 配置变量
IMAGE="172.20.32.187/pipeline-service/aimstack/aim:3.19.0-build-env"
CONTAINER_NAME="aim-ui-builder-$(date +%s)"
HOST_WORKDIR=$(pwd)
PROJECT_ROOT=$(dirname "$(dirname "$HOST_WORKDIR")") # 获取项目根目录
DOCKER_DIR="$PROJECT_ROOT/docker" # docker 目录绝对路径
CONTAINER_WORKDIR="/code"
echo "=== 开始构建 Aim UI 软件包 ==="
echo "使用镜像: $IMAGE"
echo "主机工作目录: $HOST_WORKDIR"
echo "Docker 输出目录: $DOCKER_DIR"
echo "容器工作目录: $CONTAINER_WORKDIR"
# 确保 docker 目录存在
mkdir -p "$DOCKER_DIR"
# 启动容器并执行构建
docker run --rm \
--name "$CONTAINER_NAME" \
-v "$HOST_WORKDIR:$CONTAINER_WORKDIR" \
-v "$DOCKER_DIR:/docker_out" \
-w "$CONTAINER_WORKDIR" \
"$IMAGE" \
/bin/bash -c "\
echo '== 执行构建命令 =='; \
if ! python setup.py bdist_wheel; then \
echo '构建 Aim UI 软件包失败'; \
exit 1; \
fi;"
cp dist/aim_ui*.whl ../../../docker/; \
echo '生成的文件列表:'; \
ls -lh dist/*.whl; \
echo '输出到 docker 目录的文件:'; \
ls -lh ../../../docker/aim_ui*.whl; \
echo '== 构建完成 =='
# 检查构建结果
if [ $? -eq 0 ]; then
echo "=== Aim UI 软件包构建成功 ==="
echo "生成的 wheel 文件已复制到: $DOCKER_DIR"
echo "文件列表:"
ls -lh "$DOCKER_DIR"/aim_ui*.whl
else
echo "=== 构建失败,请检查错误信息 ===" >&2
exit 1
fi

35
docker/arm-build-ui.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
# 进入182服务器然后切换到conda activate aim-build环境进行构建
#构建aim 包
echo "build aim package success"
#编译前端代码
cd ../aim/web/ui
if [ -d build ]; then
echo "rm build dir success"
rm -rf build/
fi
if [ -d aim_ui/build ]; then
echo "rm aim_ui/build dir success"
rm -rf aim_ui/build/
fi
docker run -v $(pwd):/code -w /code \
-e http_proxy=http://172.20.32.253:3128 -e https_proxy=http://172.20.32.253:3128 \
ccr.ccs.tencentyun.com/somunslotus/node:18-alpine-arm /bin/sh -c "npm config set registry https://registry.npmmirror.com && npm install --legacy-peer-deps --verbose && export NODE_OPTIONS=--openssl-legacy-provider && npm run build"
if [ $? -ne 0 ]; then
echo "build ui failed"
exit 1
fi
mv -f build/ aim_ui/
echo "build ui success"

47
docker/arm-build-whl.sh Executable file
View File

@ -0,0 +1,47 @@
#!/bin/bash
#!/bin/bash
cd ../
# Aim 软件包构建脚本
# 使用 Docker 容器环境构建并复制 wheel 文件
# 配置变量
IMAGE="172.20.32.187/pipeline-service/aimstack/aim:3.19.0-build-env"
CONTAINER_NAME="aim-builder-$(date +%s)"
HOST_WORKDIR=$(pwd)
CONTAINER_WORKDIR="/code"
echo "=== 开始构建 Aim 软件包 ==="
echo "使用镜像: $IMAGE"
echo "主机工作目录: $HOST_WORKDIR"
echo "容器工作目录: $CONTAINER_WORKDIR"
# 启动容器并执行构建
docker run --rm \
--name $CONTAINER_NAME \
-v "$HOST_WORKDIR:$CONTAINER_WORKDIR" \
-w $CONTAINER_WORKDIR \
$IMAGE \
/bin/bash -c "\
echo '== 在容器中执行构建命令 =='; \
python setup.py bdist_wheel; \
BUILD_RESULT=\$?; \
if [ \$BUILD_RESULT -ne 0 ]; then \
echo '构建 Aim 软件包失败'; \
exit 1; \
fi; \
echo '构建成功'; \
echo '复制 wheel 文件到 docker 目录'; \
cp dist/aim*.whl docker/; \
echo '== 构建完成 =='"
# 检查构建结果
if [ $? -eq 0 ]; then
echo "=== Aim 软件包构建成功 ==="
echo "生成的 wheel 文件已复制到: $HOST_WORKDIR/docker/"
ls -lh "$HOST_WORKDIR/docker/aim"*.whl
else
echo "=== 构建失败,请检查错误信息 ==="
exit 1
fi

15
docker/arm-build-whl.sh.bak Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
# 进入182服务器然后切换到conda activate aim-build环境进行构建
cd ..
#构建aim 包
python setup.py bdist_wheel
if [ $? -ne 0 ]; then
echo "build aim package failed"
exit 1
fi
cp dist/aim*.whl docker/
echo "build aim package success"

19
docker/build-env-image.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
# Docker 构建脚本(带代理设置)
# 用法:./build.sh [镜像标签]
# 设置代理配置
DOCKERFILE_PATH="." # Dockerfile 所在目录
date=$(date +%Y%m%d%H%M)
image=172.20.32.187/pipeline-service/aimstack/aim:3.19.0-build-env
# 允许通过参数设置镜像标签
# 构建命令
docker build \
-t $image \
-f Dockerfile.build-env \
"${DOCKERFILE_PATH}"

0
docker/build-image.sh Normal file → Executable file
View File

0
docker/build-wheels.sh Normal file → Executable file
View File

0
docker/create-docker-image.sh Normal file → Executable file
View File

6
docker/package-lock.json generated Normal file
View File

@ -0,0 +1,6 @@
{
"name": "code",
"lockfileVersion": 2,
"requires": true,
"packages": {}
}

View File

@ -0,0 +1,24 @@
aimrecords==0.0.7
aimrocks==0.4.0
cachetools>=4.0.0
click>=7.0
cryptography>=3.0
filelock<4,>=3.3.0
numpy<2,>=1.12.0
psutil>=5.6.7
RestrictedPython>=5.1
tqdm>=4.20.0
aiofiles>=0.5.0
alembic<2,>=1.5.0
fastapi<1,>=0.69.0
jinja2<4,>=2.10.0
pytz>=2019.1
SQLAlchemy>=1.4.1
uvicorn<1,>=0.12.0
Pillow>=8.0.0
packaging>=15.0
python-dateutil
requests
websockets
boto3
Cython==3.0.0a9

2
package-lock.json generated
View File

@ -1,5 +1,5 @@
{
"name": "aim",
"name": "code",
"lockfileVersion": 2,
"requires": true,
"packages": {}