INNER CODE UNIT · Python
_agent_path_for_dockerfile
omnirexflora-labs/omnicoreagent · src/omnicoreagent/serve/cli.py:372
def _agent_path_for_dockerfile(file_path: str, project_root: Path) -> str:
"""Return the in-container agent path for a file inside the build context."""
resolved_agent_path = Path(file_path).resolve()
resolved_project_root = project_root.resolve()
try:
relative_path = resolved_agent_path.relative_to(resolved_project_root)
except ValueError as exc:
raise click.ClickException(
"Agent file must be inside the current Docker build context"
) from exc
return f"/app/{relative_path.as_posix()}"
def _quote_docker_env_value(value: str) -> str:
"""Quote a Dockerfile ENV value while preserving ordinary path characters."""
escaped = value.replace("\\", "\\\\").replace('"', '\\"')