From bb1c851e3907f74b50743ff80732ea61c67af09e Mon Sep 17 00:00:00 2001 From: eafonyang Date: Wed, 10 Jun 2026 10:53:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(docker):=20=E8=B0=83=E6=95=B4=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=E5=8F=98=E9=87=8F=E5=8F=8A=E4=B8=8A=E4=BC=A0=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 替换MeiliSearch相关环境变量为AWS S3和OTA相关配置 - 修改挂载目录路径,统一使用/data/projects/source - 上传脚本中将输入路径转换为绝对路径,再移除项目根目录前缀获取相对路径 - 添加路径不在项目目录内时去除./前缀的回退处理 --- docker-compose.yml | 9 ++++++++- scripts/upload.sh | 19 +++++++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 349d4ae..2cf9948 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,13 +17,20 @@ services: - MEILISEARCH_URL=${MEILISEARCH_URL:-http://ip-172-31-22-170.eu-central-1.compute.internal:7700} - MEILISEARCH_API_KEY=${MEILISEARCH_API_KEY:-young9#!UJsD219921031} - MEILISEARCH_INDEX=${MEILISEARCH_INDEX:-models} + - AWS_REGION=${AWS_REGION:-eu-central-1} + - AWS_S3_OTA_BUCKET=${AWS_S3_OTA_BUCKET:-luxsin-app-bucket} + - AWS_S3_MEASUREMENT_BUCKET=${AWS_S3_MEASUREMENT_BUCKET:-luxsin-app-bucket} + - OTA_UPLOAD_DIR=${OTA_UPLOAD_DIR:-/data/projects/source} + - OTA_X8_PUBLIC_BASE=${OTA_X8_PUBLIC_BASE:-http://am.luxsinaudio.com} + - OTA_X9_URL_BASE=${OTA_X9_URL_BASE:-http://source.luxsin.net} + - PORT=8000 ports: - "8083:8000" restart: unless-stopped networks: - audio-network volumes: - - /data/project/dashboard/upload:/data/project/dashboard/upload + - /data/projects/source:/data/projects/source frontend: image: nginx:alpine diff --git a/scripts/upload.sh b/scripts/upload.sh index 21356b8..95e83f4 100755 --- a/scripts/upload.sh +++ b/scripts/upload.sh @@ -68,13 +68,20 @@ upload_all() { upload_path() { local input_path="$1" - # 转为项目根目录下的相对路径 - local rel_path - rel_path="$(cd "$(dirname "$input_path")" 2>/dev/null && realpath --relative-to="$PROJECT_ROOT" "$(pwd)/$(basename "$input_path")")" \ - || rel_path="${input_path#"$PROJECT_ROOT"/}" - if [[ -z "$rel_path" || "$rel_path" == /* ]]; then - # 如果去掉项目根前缀失败,尝试直接去掉 ./ 前缀 + # 转为绝对路径 + local abs_path + if [[ "$input_path" == /* ]]; then + abs_path="$input_path" + else + abs_path="$(cd "$(dirname "$input_path")" 2>/dev/null && pwd)/$(basename "$input_path")" + fi + + # 去掉项目根目录前缀,得到相对路径 + local rel_path="${abs_path#"$PROJECT_ROOT"/}" + + # 如果去掉前缀失败(路径不在项目内),回退到去掉 ./ 前缀 + if [[ "$rel_path" == "$abs_path" ]]; then rel_path="${input_path#./}" fi