refactor: move drivers directory into mcontainer package

- Relocate goose driver to mcontainer/drivers/
- Update ConfigManager to dynamically scan for driver YAML files
- Add support for mc-driver.yaml instead of mai-driver.yaml
- Update Driver model to support init commands and other YAML fields
- Auto-discover drivers at runtime instead of hardcoding them
- Update documentation to reflect new directory structure
This commit is contained in:
2025-03-11 19:37:11 -06:00
parent 6f08e2b274
commit 307eee4fce
10 changed files with 92 additions and 102 deletions

View File

@@ -225,25 +225,35 @@ class ContainerManager:
env_vars["MC_CONFIG_DIR"] = "/mc-config"
env_vars["MC_DRIVER_CONFIG_DIR"] = f"/mc-config/{driver_name}"
# Create driver-specific config directories
# Create driver-specific config directories and set up direct volume mounts
if driver.persistent_configs:
print("Setting up persistent configuration directories:")
for config in driver.persistent_configs:
# Get target directory path on host
target_dir = project_config_path / config.target.lstrip(
target_dir = project_config_path / config.target.removeprefix(
"/mc-config/"
)
# Create directory if it's a directory type config
if config.type == "directory":
dir_existed = target_dir.exists()
target_dir.mkdir(parents=True, exist_ok=True)
print(f" - Created directory: {target_dir}")
if not dir_existed:
print(f" - Created directory: {target_dir}")
# For files, make sure parent directory exists
elif config.type == "file":
target_dir.parent.mkdir(parents=True, exist_ok=True)
# File will be created by the container if needed
# Mount persistent config directly to container path
session_volumes[str(target_dir)] = {
"bind": config.source,
"mode": "rw",
}
print(
f" - Created direct volume mount: {target_dir} -> {config.source}"
)
# Create container
container = self.client.containers.create(
image=driver.image,