Skip to content

Commit

Permalink
feat: add ramalama labels about the execution on top of container
Browse files Browse the repository at this point in the history
fixes #798

Signed-off-by: Florent Benoit <[email protected]>
  • Loading branch information
benoitf committed Feb 13, 2025
1 parent 173cae3 commit 3592a69
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions ramalama/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,35 @@ def setup_container(self, args):
"run",
"--rm",
"-i",
]

container_labels = [
"--label",
"RAMALAMA",
"--security-opt=label=disable",
"--name",
name,
"--env=HOME=/tmp",
"--cap-drop=all",
"--security-opt=no-new-privileges",
"--init",
]
if hasattr(args, "MODEL"):
container_labels += ["--label", f"ai.ramalama.model={args.MODEL}"]
if hasattr(args, "engine"):
container_labels += ["--label", f"ai.ramalama.engine={args.engine}"]
if hasattr(args, "runtime"):
container_labels += ["--label", f"ai.ramalama.runtime={args.runtime}"]
if hasattr(args, "port"):
container_labels += ["--label", f"ai.ramalama.port={args.port}"]
if hasattr(args, "subcommand"):
container_labels += ["--label", f"ai.ramalama.command={args.subcommand}"]
conman_args.extend(container_labels)

conman_args.extend(
[
"--security-opt=label=disable",
"--name",
name,
"--env=HOME=/tmp",
"--cap-drop=all",
"--security-opt=no-new-privileges",
"--init",
]
)

if os.path.basename(args.engine) == "podman":
conman_args += ["--pull=newer"]
Expand Down

0 comments on commit 3592a69

Please sign in to comment.