mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-09-28 07:36:38 +08:00
修复部署问题
This commit is contained in:
@@ -62,7 +62,7 @@ chmod +x deploy.sh
|
||||
|
||||
#### 默认管理员账号
|
||||
|
||||
- **用户名**: admin_user
|
||||
- **账号**: admin_user
|
||||
- **密码**: admin_user
|
||||
|
||||
> ⚠️ 首次登录后请立即修改默认密码!
|
||||
|
||||
Binary file not shown.
@@ -7,12 +7,9 @@ RUN apk add --no-cache gettext
|
||||
# 复制nginx配置模板
|
||||
COPY nginx.conf.template /etc/nginx/nginx.conf.template
|
||||
|
||||
# 复制预打包的dist文件夹
|
||||
# 复制预打包的dist文件夹(包含config.js)
|
||||
COPY dist /usr/share/nginx/html
|
||||
|
||||
# 复制配置模板文件
|
||||
COPY config.template.js /usr/share/nginx/html/config.template.js
|
||||
|
||||
# 创建运行时配置脚本
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
RUN chmod +x /docker-entrypoint.sh
|
||||
|
||||
+27
-4
@@ -28,6 +28,7 @@ show_help() {
|
||||
echo " -h, --help 显示此帮助信息"
|
||||
echo ""
|
||||
echo "环境变量配置:"
|
||||
echo " SERVER_HOST 服务器地址 (默认: localhost:6365)"
|
||||
echo " VUE_APP_API_URL 前端API地址 (默认: http://localhost:6365/api/v1)"
|
||||
echo " VUE_APP_WS_URL WebSocket地址 (默认: ws://localhost:6365)"
|
||||
echo ""
|
||||
@@ -35,7 +36,10 @@ show_help() {
|
||||
echo " # 启动服务"
|
||||
echo " $0 start"
|
||||
echo ""
|
||||
echo " # 自定义服务器地址启动"
|
||||
echo " # 使用服务器IP启动"
|
||||
echo " SERVER_HOST=192.168.1.100:6365 $0 start"
|
||||
echo ""
|
||||
echo " # 自定义完整地址启动"
|
||||
echo " VUE_APP_API_URL=http://192.168.1.100:6365/api/v1 VUE_APP_WS_URL=ws://192.168.1.100:6365 $0 start"
|
||||
}
|
||||
|
||||
@@ -91,11 +95,20 @@ get_db_config() {
|
||||
start_services() {
|
||||
echo -e "${GREEN}启动Gost转发面板服务...${NC}"
|
||||
|
||||
# 设置默认环境变量
|
||||
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"}
|
||||
# 如果设置了 SERVER_HOST,自动生成 API 和 WS 地址
|
||||
if [ -n "$SERVER_HOST" ]; then
|
||||
export VUE_APP_API_URL="http://${SERVER_HOST}/api/v1"
|
||||
export VUE_APP_WS_URL="ws://${SERVER_HOST}"
|
||||
else
|
||||
# 设置默认环境变量
|
||||
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"}
|
||||
fi
|
||||
|
||||
echo -e "${YELLOW}环境变量配置:${NC}"
|
||||
if [ -n "$SERVER_HOST" ]; then
|
||||
echo "SERVER_HOST: $SERVER_HOST"
|
||||
fi
|
||||
echo "VUE_APP_API_URL: $VUE_APP_API_URL"
|
||||
echo "VUE_APP_WS_URL: $VUE_APP_WS_URL"
|
||||
echo ""
|
||||
@@ -103,6 +116,16 @@ start_services() {
|
||||
# 切换到脚本目录
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
# 生成前端配置文件
|
||||
echo -e "${YELLOW}生成前端配置文件...${NC}"
|
||||
cat > dist/config.js << EOF
|
||||
window.APP_CONFIG = {
|
||||
VUE_APP_API_URL: "$VUE_APP_API_URL",
|
||||
VUE_APP_WS_URL: "$VUE_APP_WS_URL"
|
||||
}
|
||||
EOF
|
||||
echo -e "${GREEN}配置文件已生成: dist/config.js${NC}"
|
||||
|
||||
$DOCKER_COMPOSE_CMD up -d
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
|
||||
@@ -82,8 +82,8 @@ services:
|
||||
environment:
|
||||
BACKEND_HOST: backend # 后端地址
|
||||
BACKEND_PORT: 6365 # 后端端口
|
||||
VUE_APP_API_URL: http://localhost:6365/api/v1 # 前端API地址
|
||||
VUE_APP_WS_URL: ws://localhost:6365 # 前端WebSocket地址
|
||||
VUE_APP_API_URL: ${VUE_APP_API_URL:-http://localhost:6365/api/v1} # 前端API地址
|
||||
VUE_APP_WS_URL: ${VUE_APP_WS_URL:-ws://localhost:6365} # 前端WebSocket地址
|
||||
depends_on:
|
||||
backend:
|
||||
condition: service_healthy
|
||||
|
||||
@@ -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 "$@"
|
||||
Reference in New Issue
Block a user