feat: 针对action流水线做了一些优化 #74
Reference in New Issue
Block a user
Delete Branch "main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
优化点如下:
11M压缩为3.5M。使镜像从原来的18.9M压缩为11.9M。58s压缩到45s(增加了压缩步骤的情况下),使镜像构建从原来的6min压缩到49s。Summary by CodeRabbit
Performance Improvements
Chores
Walkthrough
The release workflow now installs and uses UPX to compress built binaries for Linux AMD64 and ARM64. Go setup switches to go-version-file with dependency cache path. The Dockerfile installs UPX in the builder stage and compresses the built binary before copying into the final image.
Changes
.github/workflows/release.ymlgo-version-fileandcache-dependency-path. Add UPX installation (crazy-max/ghaction-upx@v3, install-only). Insert UPX compression steps after building Linux AMD64/ARM64 binaries and before packaging/uploading.Dockerfileupxduring module download/setup and runupx -9on the builthubproxybinary prior to copying to the final image. No stage removals or CMD changes.Sequence Diagram(s)
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches
❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between
780ac14a8fand198a18508b.📒 Files selected for processing (1)
Dockerfile(1 hunks)🚧 Files skipped from review as they are similar to previous changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands and usage tips.Actionable comments posted: 1
🧹 Nitpick comments (8)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between
714224bd29and780ac14a8f.📒 Files selected for processing (3)
.github/workflows/docker-ghcr.yml(1 hunks).github/workflows/release.yml(3 hunks)Dockerfile(1 hunks)⚠️ Potential issue | 🔴 Critical
Build will fail: missing output directory for binaries.
This workflow does not create
build/hubproxy/beforego build -o ../build/hubproxy/..., causing “no such file or directory”.Apply:
📝 Committable suggestion
🤖 Prompt for AI Agents
实际上不用创建,go build的时候会自动创建。
🧩 Analysis chain
🏁 Script executed:
Length of output: 505
🏁 Script executed:
Length of output: 594
🏁 Script executed:
Length of output: 774
@eryajf You're absolutely right! I apologize for the incorrect suggestion.
I just tested this and confirmed that
go builddoes indeed automatically create the output directory structure when using the-oflag. Bothgo build -o testdir/subdir/binaryandgo build -o build/hubproxy/test-binarysuccessfully created the intermediate directories without needingmkdir -p.Thank you for the correction - my suggestion to add directory creation was unnecessary and would have added redundant steps to the workflow.
✏️ Learnings added
@eryajf 感谢大佬PR,docker镜像使用预编译二进制文件的话不方便
docker build本地编译,我觉得dockerfile部分保持不变比较好OK,我调整下
已恢复dockerfile