Files
AI-VideoAssistant/docs/content/deployment.md
2026-02-08 09:33:32 +08:00

96 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 部署指南
## 方式一Docker 部署(推荐)
### 1. 构建镜像
```bash
docker build -t ai-video-assistant-web ./web
```
### 2. 运行容器
```bash
docker run -d \
--name ai-assistant-web \
-p 3000:80 \
ai-video-assistant-web
```
### 3. 使用 Docker Compose
```yaml
version: '3.8'
services:
web:
build: ./web
ports:
- "3000:80"
environment:
- VITE_API_URL=http://api:8080
```
运行:
```bash
docker-compose up -d
```
## 方式二Nginx 部署
### 1. 构建前端
```bash
cd web
npm run build
```
### 2. 配置 Nginx
```nginx
server {
listen 80;
server_name your-domain.com;
root /var/www/ai-assistant/dist;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location /api {
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
```
### 3. 启动 Nginx
```bash
sudo nginx -t
sudo systemctl reload nginx
```
## 环境变量配置
| 变量 | 说明 | 默认值 |
|------|------|--------|
| VITE_API_URL | 后端 API 地址 | http://localhost:8080 |
| VITE_GEMINI_API_KEY | Gemini API Key | - |
## 验证部署
1. 访问 http://your-domain.com
2. 检查页面是否正常加载
3. 验证各功能模块是否可用
## 故障排查
| 问题 | 解决方案 |
|------|---------|
| 页面空白 | 检查浏览器控制台错误 |
| API 请求失败 | 确认 VITE_API_URL 配置正确 |
| 静态资源 404 | 检查 nginx try_files 配置 |