fix(docker): 调整环境变量及上传路径处理逻辑
- 替换MeiliSearch相关环境变量为AWS S3和OTA相关配置 - 修改挂载目录路径,统一使用/data/projects/source - 上传脚本中将输入路径转换为绝对路径,再移除项目根目录前缀获取相对路径 - 添加路径不在项目目录内时去除./前缀的回退处理
This commit is contained in:
+8
-1
@@ -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
|
||||
|
||||
+13
-6
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user