libera_utils.aws.ecr_upload#
Module for uploading docker images to the ECR
Functions
|
Build a Docker image from a specified directory and tag it with a custom name. |
|
CLI handler function for ecr-upload CLI subcommand. |
|
Perform programmatic docker login to the default ECR for the current AWS credential account (e.g. AWS_PROFILE) and return a DockerClient object for interacting with the ECR. |
|
Programmatically upload a docker image for a science algorithm to an ECR. |
- libera_utils.aws.ecr_upload.build_docker_image(context_dir: str | Path, image_name: str, tag: str = 'latest', target: str | None = None, platform: str = 'linux/amd64') None #
Build a Docker image from a specified directory and tag it with a custom name.
- Parameters:
context_dir (Union[str, Path]) – The path to the directory containing the Dockerfile and other build context.
image_name (str) – The name to give the Docker image.
tag (str, optional) – The tag to apply to the image (default is ‘latest’).
target (Optional[str]) – Name of the target to build.
platform (str) – Default “linux/amd64”.
- Raises:
ValueError – If the specified directory does not exist or the build fails.
- libera_utils.aws.ecr_upload.ecr_upload_cli_func(parsed_args: Namespace) None #
CLI handler function for ecr-upload CLI subcommand.
- Parameters:
parsed_args (argparse.Namespace) – Namespace of parsed CLI arguments
- Return type:
None
- libera_utils.aws.ecr_upload.get_ecr_docker_client(region_name: str | None = None) DockerClient #
Perform programmatic docker login to the default ECR for the current AWS credential account (e.g. AWS_PROFILE) and return a DockerClient object for interacting with the ECR.
- Parameters:
region_name (Optional[str]) – AWS region name. Each region has a separate default ECR. If region_name is None, boto3 uses the default region for the configured credentials.
- Returns:
Logged in docker client.
- Return type:
docker.DockerClient
- libera_utils.aws.ecr_upload.push_image_to_ecr(image_name: str, image_tag: str, algorithm_name: str | ProcessingStepIdentifier, region_name: str = 'us-west-2', verbose: bool = False) None #
Programmatically upload a docker image for a science algorithm to an ECR. ECR name is determined based on the algorithm name.
- Parameters:
image_name (str) – Name of the image
image_tag (str) – Tag of the image (often latest)
algorithm_name (Union[str, constants.ProcessingStepIdentifier]) – Processing step ID string or object. Used to infer the ECR repository name.
region_name (str) – AWS region. Used to infer the ECR name.
verbose (bool) – Enable debug logging
- Return type:
None