feat: 添加 Docker 部署配置

- 添加 Dockerfile (多阶段构建: Node 构建 → Nginx 托管)
- 添加 docker-compose.yml (端口 8801, 自动重启)
- 添加 .dockerignore (减少构建体积)
- 添加 docker-deploy.md (部署文档)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jowe
2026-03-24 01:18:52 +08:00
parent 9dfa2a9532
commit 7fe1586dc0
4 changed files with 159 additions and 0 deletions

60
docker-deploy.md Normal file
View File

@@ -0,0 +1,60 @@
# 天选公司 - Docker 部署配置
## 快速部署
### 首次部署
```bash
# 1. 拉取代码
git pull
# 2. 构建并启动容器
docker-compose up -d --build
# 3. 查看日志
docker-compose logs -f
```
### 更新部署
```bash
# 1. 拉取最新代码
git pull
# 2. 重新构建并重启
docker-compose up -d --build
```
### 常用命令
```bash
# 启动
docker-compose up -d
# 停止
docker-compose down
# 重启
docker-compose restart
# 查看状态
docker-compose ps
# 查看日志
docker-compose logs -f
# 查看实时资源
docker stats
```
## 端口配置
- 容器内80 (Nginx)
- 宿主机映射8801
## 1Panel 反向代理配置
目标地址:`http://127.0.0.1:8801`
## 环境说明
- Node 版本20-alpine (构建阶段)
- Nginx 版本alpine (运行阶段)
- 构建产物直接打包进容器,无需在宿主机安装 Node.js