feat(builder): add ipadapter support - exposing pip install

This commit is contained in:
bennykok 2024-01-26 20:16:10 +08:00
parent 731bdf3982
commit 954de12d08
3 changed files with 12 additions and 2 deletions

View File

@ -142,6 +142,7 @@ def read_root():
class GitCustomNodes(BaseModel):
hash: str
disabled: bool
pip: Optional[List[str]] = None
class FileCustomNodes(BaseModel):
filename: str
@ -377,13 +378,19 @@ async def build_logic(item: Item):
cp_process = await asyncio.subprocess.create_subprocess_exec("cp", "-r", "/app/src/template", folder_path)
await cp_process.wait()
pip_modules = set()
for git_custom_node in item.snapshot.git_custom_nodes.values():
if git_custom_node.pip:
pip_modules.update(git_custom_node.pip)
# Write the config file
config = {
"name": item.name,
"deploy_test": os.environ.get("DEPLOY_TEST_FLAG", "False"),
"gpu": item.gpu,
"public_model_volume": "model-store",
"private_model_volume": item.model_volume_name
"private_model_volume": item.model_volume_name,
"pip": list(pip_modules)
}
with open(f"{folder_path}/config.py", "w") as f:
f.write("config = " + json.dumps(config))

View File

@ -65,6 +65,8 @@ if not deploy_test:
.run_commands("chmod +x /start.sh")
# Restore the custom nodes first
.pip_install(config["pip"])
.copy_local_file(f"{current_directory}/data/restore_snapshot.py", "/")
.copy_local_file(f"{current_directory}/data/snapshot.json", "/comfyui/custom_nodes/ComfyUI-Manager/startup-scripts/restore-snapshot.json")
.run_commands("python restore_snapshot.py")

View File

@ -3,5 +3,6 @@ config = {
"deploy_test": "True",
"gpu": "T4",
"public_model_volume": "model-store",
"private_model_volume": "private-model-store"
"private_model_volume": "private-model-store",
"pip": []
}