refactor: enhance Dockerfile and Justfile for multi-feature builds; i…#39
Conversation
…mprove logging in Gixor initialization
There was a problem hiding this comment.
Pull request overview
This pull request refactors the Dockerfile and Justfile to support building Docker images with multiple feature flags (default, uselibgit, usegix), fixes a bug in the git2 repository opening logic, and adds debug logging to the Gixor initialization process.
Changes:
- Refactored Docker build recipes in Justfile to support multiple feature builds with different tags
- Updated Dockerfile to accept FEATURES and APT_OPTIONAL build arguments for flexible builds
- Fixed bug in git2.rs where repository was incorrectly opened using file path instead of repository path
- Added debug logging in Gixor initialization to display config path and contents
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| lib/src/lib.rs | Added debug logging statements to log configuration path and JSON-serialized config during Gixor initialization |
| lib/src/gitbridge/git2.rs | Fixed bug: changed from opening git repository using boilerplate file path to using repository root path |
| Justfile | Refactored docker and docker_buildx recipes to build multiple Docker images with different feature flags; added command to gen_complete recipe |
| Dockerfile | Added FEATURES and APT_OPTIONAL build arguments; fixed base-path to use absolute path; added apt-get installation for optional packages; added chown for nonroot user |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| && mkdir -p /app /opt/gixor/boilerplates | ||
| && mkdir -p /app /opt/gixor/boilerplates \ | ||
| && apt-get update \ | ||
| && apt-get install --no-install-recommends -y $APT_OPTIONAL ca-certificates \ |
There was a problem hiding this comment.
The ARG APT_OPTIONAL is defined in the builder stage but is used here in the runtime stage. In Docker, ARG values don't carry over between stages unless redeclared. Add "ARG APT_OPTIONAL" in the runtime stage (after line 26 or before line 33) to make the build argument available in this stage.
| impl Gixor { | ||
| fn new(config: Config, load_from: PathBuf) -> Self { | ||
| log::debug!("config path: {load_from:?}"); | ||
| log::debug!("config: {}", serde_json::to_string_pretty(&config).unwrap()); |
There was a problem hiding this comment.
Using unwrap() in a logging statement can cause a panic if the config fails to serialize to JSON (e.g., if it contains non-serializable data). Consider using unwrap_or_else() or unwrap_or() to provide a fallback message instead of panicking during logging.
| log::debug!("config: {}", serde_json::to_string_pretty(&config).unwrap()); | |
| log::debug!( | |
| "config: {}", | |
| serde_json::to_string_pretty(&config) | |
| .unwrap_or_else(|e| format!("(failed to serialize config: {e})")) | |
| ); |
| @@ -28,9 +31,16 @@ LABEL org.opencontainers.image.source=https://github.com/tamada/gixor \ | |||
| org.opencontainers.image.description="Git Ignore Managenemnt System for Multiple Repositories." | |||
There was a problem hiding this comment.
Spelling error: "Managenemnt" should be "Management".
| org.opencontainers.image.description="Git Ignore Managenemnt System for Multiple Repositories." | |
| org.opencontainers.image.description="Git Ignore Management System for Multiple Repositories." |
…mprove logging in Gixor initialization