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