[WIP] feat: add Gemini CLI image with fixed user/group handling#18
[WIP] feat: add Gemini CLI image with fixed user/group handling#18
Conversation
- Add complete Gemini CLI container image for AI-powered development - Support Google Gemini models (1.5 Pro, Flash) with configurable settings - Include comprehensive plugin system for authentication and configuration - Fix user/group creation conflicts with existing base image users - Dynamic username handling for compatibility with node:20-slim base - Persistent configuration for .config/gemini and .cache/gemini - Test suite for Docker build, API key setup, and Cubbi integration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
| def _ensure_gemini_dirs(self) -> tuple[Path, Path]: | ||
| """Ensure Gemini directories exist with correct ownership""" | ||
| config_dir = self._get_gemini_config_dir() | ||
| cache_dir = self._get_gemini_cache_dir() | ||
|
|
||
| # Create directories | ||
| for directory in [config_dir, cache_dir]: | ||
| try: | ||
| directory.mkdir(mode=0o755, parents=True, exist_ok=True) | ||
| self._set_ownership(directory) | ||
| except OSError as e: | ||
| self.status.log( | ||
| f"Failed to create Gemini directory {directory}: {e}", "ERROR" | ||
| ) | ||
|
|
||
| return config_dir, cache_dir |
There was a problem hiding this comment.
Suggestion: The function should handle the case where it fails to create a directory by returning early or raising an exception. Currently, it continues execution even after logging an error, which could lead to issues when the directories don't exist. [possible issue, importance: 8]
| def _ensure_gemini_dirs(self) -> tuple[Path, Path]: | |
| """Ensure Gemini directories exist with correct ownership""" | |
| config_dir = self._get_gemini_config_dir() | |
| cache_dir = self._get_gemini_cache_dir() | |
| # Create directories | |
| for directory in [config_dir, cache_dir]: | |
| try: | |
| directory.mkdir(mode=0o755, parents=True, exist_ok=True) | |
| self._set_ownership(directory) | |
| except OSError as e: | |
| self.status.log( | |
| f"Failed to create Gemini directory {directory}: {e}", "ERROR" | |
| ) | |
| return config_dir, cache_dir | |
| def _ensure_gemini_dirs(self) -> tuple[Path, Path]: | |
| """Ensure Gemini directories exist with correct ownership""" | |
| config_dir = self._get_gemini_config_dir() | |
| cache_dir = self._get_gemini_cache_dir() | |
| # Create directories | |
| for directory in [config_dir, cache_dir]: | |
| try: | |
| directory.mkdir(mode=0o755, parents=True, exist_ok=True) | |
| self._set_ownership(directory) | |
| except OSError as e: | |
| self.status.log( | |
| f"Failed to create Gemini directory {directory}: {e}", "ERROR" | |
| ) | |
| raise RuntimeError(f"Failed to create required directory: {directory}") | |
| return config_dir, cache_dir |
| def test_docker_build(): | ||
| """Test Docker image build""" | ||
| print("\n" + "=" * 60) | ||
| print("🧪 Testing Docker Image Build") | ||
| print("=" * 60) | ||
|
|
||
| result = run_command( | ||
| "cd /home/bouthilx/projects/cubbi/cubbi/images/gemini-cli && docker build -t monadical/cubbi-gemini-cli:latest .", | ||
| "Building Gemini CLI Docker image", | ||
| ) | ||
|
|
||
| if result.returncode == 0: | ||
| print("✅ Gemini CLI Docker image built successfully") | ||
| return True | ||
| else: | ||
| print("❌ Gemini CLI Docker image build failed") | ||
| return False |
There was a problem hiding this comment.
Suggestion: The test function contains a hardcoded absolute path to a specific user's home directory (/home/bouthilx/projects/cubbi/...), which will fail when run on other systems. Use a relative path or environment variable instead. [possible issue, importance: 9]
| def test_docker_build(): | |
| """Test Docker image build""" | |
| print("\n" + "=" * 60) | |
| print("🧪 Testing Docker Image Build") | |
| print("=" * 60) | |
| result = run_command( | |
| "cd /home/bouthilx/projects/cubbi/cubbi/images/gemini-cli && docker build -t monadical/cubbi-gemini-cli:latest .", | |
| "Building Gemini CLI Docker image", | |
| ) | |
| if result.returncode == 0: | |
| print("✅ Gemini CLI Docker image built successfully") | |
| return True | |
| else: | |
| print("❌ Gemini CLI Docker image build failed") | |
| return False | |
| def test_docker_build(): | |
| """Test Docker image build""" | |
| print("\n" + "=" * 60) | |
| print("🧪 Testing Docker Image Build") | |
| print("=" * 60) | |
| result = run_command( | |
| "docker build -t monadical/cubbi-gemini-cli:latest .", | |
| "Building Gemini CLI Docker image", | |
| ) | |
| if result.returncode == 0: | |
| print("✅ Gemini CLI Docker image built successfully") | |
| return True | |
| else: | |
| print("❌ Gemini CLI Docker image build failed") | |
| return False |
- Fix hardcoded paths in tests to use dynamic path resolution - Update gemini-cli plugin to use actual username instead of hardcoded "cubbi" - Simplify persistent configuration test to use ~ instead of absolute paths - Remove unused imports and improve test reliability - Ensure configuration files are created in correct user directories 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
User description
🤖 Generated with Claude Code
Not tested yet, need access to gemini.
PR Type
Enhancement
Description
Add Gemini CLI container image
Support Google Gemini models configuration
Fix user/group handling for node base
Implement persistent configuration directories
Changes walkthrough 📝
gemini_cli_plugin.py
Authentication and configuration plugin for Gemini CLIcubbi/images/gemini-cli/gemini_cli_plugin.py
Dockerfile
Dockerfile for Gemini CLI container imagecubbi/images/gemini-cli/Dockerfile
test_gemini.py
Test suite for Gemini CLI container imagecubbi/images/gemini-cli/test_gemini.py
README.md
Documentation for Gemini CLI container imagecubbi/images/gemini-cli/README.md
cubbi_image.yaml
Cubbi image configuration for Gemini CLIcubbi/images/gemini-cli/cubbi_image.yaml