feat: add Docker image building to CI/CD workflows - #124
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #124 +/- ##
=====================================
Coverage 6.72% 6.72%
=====================================
Files 15 15
Lines 1279 1279
Branches 32 32
=====================================
Hits 86 86
Misses 1191 1191
Partials 2 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Add .dockerignore file for efficient Docker builds - Implement multi-stage Dockerfile with security best practices - Add Docker build/push job to build-and-test workflow for main branch - Add Docker build/push job to release workflow for tagged releases - Configure GHCR (GitHub Container Registry) as target registry - Add semantic-release GitHub plugin for proper release detection - Update README with Docker usage documentation and examples - Add Docker configuration tests - Support multi-platform builds (amd64/arm64) - Implement proper image tagging strategy (latest, semver tags) Co-authored-by: chrisdoc <9047291+chrisdoc@users.noreply.github.com>
There was a problem hiding this comment.
✨ PR Review
The PR adds comprehensive Docker support with multi-stage builds and CI/CD integration. The implementation looks solid overall, but there are some consistency and safety issues in the HTTP server code that need attention.
2 issues detected:
🧹 Maintainability - Mixed use of optional chaining and non-null assertion for the same object creates confusing and inconsistent code patterns.
Details: The code uses optional chaining on line 60 but non-null assertion on line 61 when accessing the same session object. This inconsistency makes the code harder to understand and reason about, especially since both lines are within the same conditional block that already verifies the session exists.
File:src/utils/httpServer.ts (60-61)🐞 Bug - Calling methods on potentially undefined object without null checking can cause runtime TypeError exceptions.
Details: The code uses optional chaining to get the transport object but then immediately calls a method on it without checking if it's undefined. Even though there's an earlier check for session existence, race conditions could cause the transport to be undefined, leading to a TypeError when calling handleRequest.
File:src/utils/httpServer.ts (113-114)
Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using. We'd love your feedback! 🚀
| const transport = transports.get(sessionId)?.transport; | ||
| await transport.handleRequest(req, res); |
There was a problem hiding this comment.
🐞 Bug - Potential Runtime Error: Either use non-null assertion (!) if you trust the earlier session existence check, or add a null check before calling transport.handleRequest to handle the case where transport might be undefined.
| const transport = transports.get(sessionId)?.transport; | |
| await transport.handleRequest(req, res); | |
| const transport = transports.get(sessionId)?.transport; | |
| if (!transport) { | |
| res.status(500).send("Transport not available"); | |
| return; | |
| } | |
| await transport.handleRequest(req, res); |
Co-authored-by: gitstream-cm[bot] <111687743+gitstream-cm[bot]@users.noreply.github.com>
There was a problem hiding this comment.
✨ PR Review
The PR successfully implements Docker containerization with multi-stage builds and CI/CD automation. The implementation follows Docker best practices with non-root users and optimized layers, but there's a potential build failure issue in the Dockerfile.
1 issues detected:
🐞 Bug - Docker COPY command will fail if the source directory doesn't exist, breaking the container build process.
Details: The Dockerfile attempts to copy a
src/generateddirectory from the builder stage that may not exist if the build process doesn't generate this directory. This will cause the Docker build to fail with a "no such file or directory" error.
File:Dockerfile (26-26)
Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using. We'd love your feedback! 🚀
|
|
||
| # Copy built application from builder stage | ||
| COPY --from=builder /app/dist ./dist | ||
| COPY --from=builder /app/src/generated ./src/generated |
There was a problem hiding this comment.
🐞 Bug - Potential Build Failure: Either ensure the src/generated directory is always created during the build process, or make the COPY operation conditional using a wildcard pattern like COPY --from=builder /app/src/generated* ./src/ or check if the directory exists before copying.
| COPY --from=builder /app/src/generated ./src/generated | |
| COPY --from=builder /app/src/generated* ./src/ |
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| await transport.handleRequest(req, res); | ||
| }; | ||
| const transport = transports.get(sessionId)?.transport; | ||
| await transport.handleRequest(req, res); |
There was a problem hiding this comment.
Bug: Optional Chaining Misuse Causes Runtime Error
The optional chaining (?.) for transport on line 113 introduces a potential runtime error. While the preceding transports.has(sessionId) check guarantees transport exists, the optional chaining makes it potentially undefined in type. The subsequent call to transport.handleRequest() on line 114 then lacks a null check, which could lead to a crash. The original non-null assertion (!) was appropriate here.
# [1.9.0](v1.8.10...v1.9.0) (2025-09-18) ### Bug Fixes * **docekr:** fix docker image ([a6416a3](a6416a3)) * **misc:** fix package.json parsing ([00cb197](00cb197)) * **plan:** remove plan ([86263e4](86263e4)) ### Features * add Docker image building to CI/CD workflows ([#124](#124)) ([760963e](760963e))
This PR implements comprehensive Docker image building and publishing in the CI/CD pipeline, enabling automated containerized deployments of the hevy-mcp server.
Changes Made
Docker Configuration
linux/amd64andlinux/arm64architecturesCI/CD Workflows
latest,main, andmain-<commit-sha>v1.8.8,v1.8,v1) pluslatestDocumentation & Testing
Usage Examples
Pull and run the latest image:
Docker Compose deployment:
Image Tagging Strategy
latest,main,main-<sha>v1.8.8,v1.8,v1,latestThe implementation follows Docker and GitHub Actions best practices, includes comprehensive error handling, and maintains backward compatibility with existing deployment methods.
Addressing the request to build Docker images during CI/CD.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.
✨ PR Description
Purpose: Add Docker containerization support with CI/CD integration for automated image building, pushing to GitHub Container Registry, and versioned releases.
Main changes:
Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using. We'd love your feedback! 🚀