aws / aws/bedrock-agentcore-starter-toolkit

[Feature] allow for build-args and other arguments for local image build

Open
#187 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
508
Forks
155
Avg merge
8h 50m
Merged PRs (30d)
4

Description

We have our dependencies in an internal repository which requires authentication.
Currently is there is no way to expose them to the image build without explicitly including them in the docker file.

Proposing build args to the cli launch command: `/bedrock_agentcore_starter_toolkit/cli/runtime/commands.py`, something like:
```python
# add to launch arguments

build_arguments: Optional[List[str]] = typer.Option(
None, "--build-args", "-ba", help="Build arguments for agent (format: KEY=VALUE)"
)

# add to launch function

build_args = None
if build_arguments:
build_args = {}
for build_arg in build_arguments:
if "=" not in build_arg:
_handle_error(f"Invalid build argument variable format: {build_arg}. Use KEY=VALUE format.")
key, value = build_arg.split("=", 1)
build_args[key] = value

# Call the operation - CodeBuild is now default, unless --local-build is specified
result = launch_bedrock_agentcore(
config_path=config_path,
agent_name=agent,
local=local,
use_codebuild=not local_build,
env_vars=env_vars,
auto_update_on_conflict=auto_update_on_conflict,
build_args=build_args,
)
```

and update `/bedrock_agentcore_starter_toolkit/utils/runtime/container.py
```python
def build(self, dockerfile_dir: Path, tag: str, platform: Optional[str] = None, build_args: Optional[dict[str, str]] = None) -> Tuple[bool, List[str]]:

...

cmd = [self.runtime, "build", "-t", tag]
build_platform = platform or self.DEFAULT_PLATFORM
cmd.extend(["--platform", build_platform])
cmd.extend([x for k, v in build_args.items() for x in ("--build-arg", k, v)])
cmd.append(str(dockerfile_dir))

```

Contributor guide

Open the contributing guide

Research direction

Start in bedrock_agentcore_starter_toolkit/cli/runtime/commands.py and trace the launch command through to launch_bedrock_agentcore, then read bedrock_agentcore_starter_toolkit/utils/runtime/container.py and its build method. Done means the CLI accepts KEY=VALUE build arguments, rejects invalid formats, and forwards valid arguments to the local image build command.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
build-system, cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.