修复部署问题

This commit is contained in:
qaq
2025-06-13 09:25:32 +08:00
parent 344262cc34
commit 2fa15fe4c3
6 changed files with 32 additions and 19 deletions
+1 -8
View File
@@ -3,23 +3,16 @@
# 设置默认环境变量
export BACKEND_HOST=${BACKEND_HOST:-backend}
export BACKEND_PORT=${BACKEND_PORT:-6365}
export VUE_APP_API_URL=${VUE_APP_API_URL:-"http://localhost:6365/api/v1"}
export VUE_APP_WS_URL=${VUE_APP_WS_URL:-"ws://localhost:6365"}
echo "=== 容器启动配置 ==="
echo "BACKEND_HOST: $BACKEND_HOST"
echo "BACKEND_PORT: $BACKEND_PORT"
echo "VUE_APP_API_URL: $VUE_APP_API_URL"
echo "VUE_APP_WS_URL: $VUE_APP_WS_URL"
echo "===================="
# 使用envsubst替换nginx配置中的环境变量
envsubst '${BACKEND_HOST} ${BACKEND_PORT}' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf
# 使用envsubst替换前端配置文件中的环境变量
envsubst '${VUE_APP_API_URL} ${VUE_APP_WS_URL}' < /usr/share/nginx/html/config.template.js > /usr/share/nginx/html/config.js
echo "配置文件已生成"
echo "Nginx配置文件已生成"
# 启动nginx
exec "$@"