fix(docker): 调整环境变量及上传路径处理逻辑

- 替换MeiliSearch相关环境变量为AWS S3和OTA相关配置
- 修改挂载目录路径,统一使用/data/projects/source
- 上传脚本中将输入路径转换为绝对路径,再移除项目根目录前缀获取相对路径
- 添加路径不在项目目录内时去除./前缀的回退处理
This commit is contained in:
eafonyang
2026-06-10 10:53:51 +08:00
parent 316852274a
commit bb1c851e39
2 changed files with 21 additions and 7 deletions
+8 -1
View File
@@ -17,13 +17,20 @@ services:
- MEILISEARCH_URL=${MEILISEARCH_URL:-http://ip-172-31-22-170.eu-central-1.compute.internal:7700} - 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_API_KEY=${MEILISEARCH_API_KEY:-young9#!UJsD219921031}
- MEILISEARCH_INDEX=${MEILISEARCH_INDEX:-models} - 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: ports:
- "8083:8000" - "8083:8000"
restart: unless-stopped restart: unless-stopped
networks: networks:
- audio-network - audio-network
volumes: volumes:
- /data/project/dashboard/upload:/data/project/dashboard/upload - /data/projects/source:/data/projects/source
frontend: frontend:
image: nginx:alpine image: nginx:alpine
+13 -6
View File
@@ -68,13 +68,20 @@ upload_all() {
upload_path() { upload_path() {
local input_path="$1" 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#./}" rel_path="${input_path#./}"
fi fi