File tree Expand file tree Collapse file tree 15 files changed +482
-3
lines changed
Expand file tree Collapse file tree 15 files changed +482
-3
lines changed Original file line number Diff line number Diff line change 1+ # Node.js
2+ node_modules
3+ npm-debug.log *
4+ yarn-debug.log *
5+ yarn-error.log *
6+
7+ # Build output (在构建过程中会重新生成)
8+ dist
9+
10+ # Coverage
11+ coverage
12+
13+ # Environment variables
14+ .env
15+ .env.local
16+ .env.development.local
17+ .env.test.local
18+ .env.production.local
19+
20+ # IDE
21+ .vscode
22+ .idea
23+
24+ # OS
25+ .DS_Store
26+ Thumbs.db
27+
28+ # Git
29+ .git
30+ .gitignore
31+
32+ # Docker
33+ Dockerfile
34+ docker-compose.yaml
35+ .dockerignore
36+
37+ # Testing
38+ test
39+ * .test.ts
40+ * .test.js
41+
42+ # Documentation
43+ README.md
44+ * .md
45+
46+ # Logs
47+ logs
48+ * .log
49+
50+ # Runtime data
51+ pids
52+ * .pid
53+ * .seed
54+ * .pid.lock
55+
56+ # Optional npm cache directory
57+ .npm
58+
59+ # ESLint cache
60+ .eslintcache
61+
62+ # Prettier
63+ .prettierrc
64+ .prettierignore
65+
66+ # 注释掉这些重要文件,确保它们被包含在构建上下文中
67+ # package.json
68+ # package-lock.json
69+ # tsconfig.json
70+ # Dockerfile
71+ # docker-compose.yaml
72+ # .dockerignore
Original file line number Diff line number Diff line change 1+ # Environment Variables
2+ # Copy this file to .env and fill in your actual values
3+
4+ # OpenAI API Key
5+ OPENAI_API_KEY = your_openai_api_key_here
6+
7+ # Application Settings
8+ NODE_ENV = development
Original file line number Diff line number Diff line change 1+ # Environment Variables
2+ # Copy this file to .env and fill in your actual values
3+
4+ # OpenAI API Key
5+ OPENAI_API_KEY = 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
6+
7+ # Application Settings
8+ NODE_ENV = production
Original file line number Diff line number Diff line change 1+ # Environment Variables
2+ # Copy this file to .env and fill in your actual values
3+
4+ # OpenAI API Key
5+ OPENAI_API_KEY=Your-API-Key-Here
6+
7+ # Application Settings
8+ NODE_ENV=production
Original file line number Diff line number Diff line change 1+ name : Build Image for API
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ jobs :
9+ build :
10+ runs-on : ubuntu-latest
11+ permissions :
12+ contents : read
13+ packages : write
14+
15+ steps :
16+ - name : Checkout code
17+ uses : actions/checkout@v4
18+ with :
19+ submodules : true
20+ token : ${{ secrets.PERSONAL_ACCESS_TOKEN }}
21+
22+ - name : Set up Docker Buildx
23+ uses : docker/setup-buildx-action@v3
24+
25+ - name : Log in to GitHub Container Registry
26+ uses : docker/login-action@v3
27+ with :
28+ registry : ghcr.io
29+ username : ${{ github.actor }}
30+ password : ${{ secrets.GITHUB_TOKEN }}
31+
32+ - name : Get short SHA
33+ id : sha
34+ run : echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
35+
36+ - name : Build and push Docker image
37+ run : |
38+ docker build --no-cache -t ghcr.io/paperdebugger/pd-core-latex:api-${{ steps.sha.outputs.SHORT_SHA }} -f docker/api/Dockerfile .
39+ docker push ghcr.io/paperdebugger/pd-core-latex:api-${{ steps.sha.outputs.SHORT_SHA }}
Original file line number Diff line number Diff line change 11{
22 "cSpell.words" : [
33 " documentclass" ,
4+ " eslintcache" ,
5+ " healthcheck" ,
46 " icmltitle" ,
57 " jizhou" ,
68 " Junyi" ,
79 " newcommand" ,
810 " paperdebugger" ,
11+ " pids" ,
912 " SUBSUBSECTION" ,
1013 " textbf" ,
1114 " textit" ,
Original file line number Diff line number Diff line change 1+ # Docker 操作快捷命令
2+
3+ .PHONY : build up down dev dev-down logs clean test
4+
5+ # 生产环境
6+ build :
7+ docker-compose build
8+
9+ up :
10+ docker-compose up -d
11+
12+ down :
13+ docker-compose down
14+
15+ logs :
16+ docker-compose logs -f api
17+
18+ # 开发环境
19+ dev :
20+ docker-compose -f docker-compose.dev.yaml up --build
21+
22+ dev-down :
23+ docker-compose -f docker-compose.dev.yaml down
24+
25+ dev-logs :
26+ docker-compose -f docker-compose.dev.yaml logs -f api-dev
27+
28+ # 测试
29+ test :
30+ docker-compose -f docker-compose.dev.yaml exec api-dev npm test
31+
32+ # 清理
33+ clean :
34+ docker-compose down -v --rmi all
35+ docker-compose -f docker-compose.dev.yaml down -v --rmi all
36+
37+ # 重建
38+ rebuild :
39+ docker-compose down
40+ docker-compose build --no-cache
41+ docker-compose up -d
42+
43+ # 查看状态
44+ status :
45+ docker-compose ps
46+
47+ # 进入容器 shell
48+ shell :
49+ docker-compose exec api sh
50+
51+ dev-shell :
52+ docker-compose -f docker-compose.dev.yaml exec api-dev sh
Original file line number Diff line number Diff line change 1+ # Docker 使用指南
2+
3+ 本项目提供了完整的 Docker 支持,包括生产环境和开发环境的配置。
4+
5+ ## 快速开始
6+
7+ ### 生产环境
8+
9+ ``` bash
10+ # 构建并启动服务
11+ make build
12+ make up
13+
14+ # 或者直接使用 docker-compose
15+ docker-compose up -d --build
16+ ```
17+
18+ ### 开发环境
19+
20+ ``` bash
21+ # 启动开发环境(支持热重载)
22+ make dev
23+
24+ # 或者直接使用 docker-compose
25+ docker-compose -f docker-compose.dev.yaml up --build
26+ ```
27+
28+ ## 文件说明
29+
30+ ### Docker 相关文件
31+
32+ - ` docker/Dockerfile ` - 多阶段构建的 Dockerfile
33+ - ` docker-compose.yaml ` - 生产环境配置
34+ - ` docker-compose.dev.yaml ` - 开发环境配置
35+ - ` .dockerignore ` - Docker 构建时忽略的文件
36+ - ` Makefile ` - 便捷的 Docker 操作命令
37+
38+ ### Dockerfile 特性
39+
40+ - ** 多阶段构建** :优化镜像大小,分离构建和运行环境
41+ - ** 安全性** :使用非 root 用户运行应用
42+ - ** 健康检查** :自动监控应用状态
43+ - ** Alpine Linux** :轻量级基础镜像
44+
45+ ## 可用命令
46+
47+ ### 生产环境
48+ ``` bash
49+ make build # 构建镜像
50+ make up # 启动服务
51+ make down # 停止服务
52+ make logs # 查看日志
53+ make status # 查看状态
54+ make shell # 进入容器 shell
55+ ```
56+
57+ ### 开发环境
58+ ``` bash
59+ make dev # 启动开发环境
60+ make dev-down # 停止开发环境
61+ make dev-logs # 查看开发环境日志
62+ make dev-shell # 进入开发容器 shell
63+ make test # 运行测试
64+ ```
65+
66+ ### 维护命令
67+ ``` bash
68+ make clean # 清理所有镜像和容器
69+ make rebuild # 重新构建(无缓存)
70+ ```
71+
72+ ## 环境变量
73+
74+ ### 生产环境
75+ - ` NODE_ENV=production `
76+ - ` PORT=8000 `
77+
78+ ### 开发环境
79+ - ` NODE_ENV=development `
80+ - ` PORT=8000 `
81+
82+ ## 端口映射
83+
84+ - 应用端口:` 8000:8000 `
85+ - 本地访问:` http://localhost:8000 `
86+
87+ ## 网络
88+
89+ - 生产环境网络:` paperdebugger-mcp-network `
90+ - 开发环境网络:` paperdebugger-mcp-network-dev `
91+
92+ ## 健康检查
93+
94+ 应用包含自动健康检查,会定期检查服务状态:
95+ - 检查间隔:30秒
96+ - 超时时间:3秒
97+ - 重试次数:3次
98+ - 启动等待时间:5秒
99+
100+ ## 开发环境特性
101+
102+ 开发环境配置包含以下特性:
103+ - 源代码热重载
104+ - TypeScript 直接运行(通过 ts-node)
105+ - 完整的开发依赖
106+ - 交互式终端支持
107+
108+ ## 故障排除
109+
110+ ### 常见问题
111+
112+ 1 . ** 端口被占用**
113+ ``` bash
114+ # 检查端口使用情况
115+ lsof -i :8000
116+ # 或者修改 docker-compose.yaml 中的端口映射
117+ ```
118+
119+ 2 . ** 构建失败**
120+ ``` bash
121+ # 清理缓存重新构建
122+ make rebuild
123+ ```
124+
125+ 3 . ** 查看详细日志**
126+ ``` bash
127+ # 生产环境
128+ make logs
129+
130+ # 开发环境
131+ make dev-logs
132+ ```
133+
134+ 4 . ** 进入容器调试**
135+ ``` bash
136+ # 生产环境
137+ make shell
138+
139+ # 开发环境
140+ make dev-shell
141+ ```
Original file line number Diff line number Diff line change 1+ # PaperDebugger MCP
2+
3+ ``` bash
4+ # 快速启动生产环境
5+ make build && make up
6+
7+ # 停止环境
8+ make down
9+
10+ # 快速启动开发环境(自动构建和启动)
11+ make dev
12+
13+ # 查看日志
14+ make logs
15+
16+ # 清理环境
17+ make clean
18+ ```
Original file line number Diff line number Diff line change 1+ services :
2+ api-dev :
3+ build :
4+ context : .
5+ dockerfile : docker/Dockerfile
6+ target : build # 使用包含开发依赖的构建阶段
7+ command : npm run start # 使用 ts-node 直接运行 TypeScript
8+ ports :
9+ - " 8000:8000"
10+ env_file :
11+ - .env
12+ # volumes:
13+ # # 挂载源代码用于开发时热重载
14+ # - ./src:/app/src:ro
15+ # - ./dist:/app/dist:ro
16+ # - ./package.json:/app/package.json:ro
17+ # - ./tsconfig.json:/app/tsconfig.json:ro
18+ # # 防止覆盖 node_modules
19+ # - /app/node_modules
20+ networks :
21+ - paperdebugger-mcp-network-dev
22+ restart : unless-stopped
23+ stdin_open : true
24+ tty : true
25+
26+ networks :
27+ paperdebugger-mcp-network-dev :
28+ driver : bridge
You can’t perform that action at this time.
0 commit comments