fix: resolve CHANGELOG.md path issue for Docker deployment
Some checks failed
Deploy BillAI / Deploy to Production (push) Has been cancelled
Some checks failed
Deploy BillAI / Deploy to Production (push) Has been cancelled
- Update changelog.go to use binary directory as base path - Uses os.Executable() instead of relative path '..' - Automatically adapts to local and Docker environments - Modify server Dockerfile build context - Change context from ./server to project root (.) - Update COPY commands for new context - Add CHANGELOG.md to container image - Update AGENTS.md guidelines - Explicitly specify relative path format for file references This ensures the changelog API works correctly in both local development and Docker deployment environments.
This commit is contained in:
@@ -20,8 +20,11 @@ func ParseChangelog() ([]ChangelogEntry, error) {
|
||||
// 获取项目根目录
|
||||
rootDir := os.Getenv("PROJECT_ROOT")
|
||||
if rootDir == "" {
|
||||
// 如果未设置,使用相对路径推测
|
||||
rootDir = ".."
|
||||
// 使用二进制文件所在目录作为基准
|
||||
execPath, err := os.Executable()
|
||||
if err == nil {
|
||||
rootDir = filepath.Dir(execPath)
|
||||
}
|
||||
}
|
||||
|
||||
changelogPath := filepath.Join(rootDir, "CHANGELOG.md")
|
||||
|
||||
Reference in New Issue
Block a user