gentle-processor-37442
10/29/2024, 10:26 AMgenerate_embedding_lamda_image = docker_build.Image("generate-embedding-lamda-image",
# Tag our image with our ECR repository's address.
tags=[ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:latest")],
context=docker_build.BuildContextArgs(
location="./lamdas/generate-embedding-lamda",
),
# Use the pushed image as a cache source.
cache_from=[docker_build.CacheFromArgs(
registry=docker_build.CacheFromRegistryArgs(
ref=ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:latest"),
),
)],
# Include an inline cache with our pushed image.
cache_to=[docker_build.CacheToArgs(
inline=docker_build.CacheToInlineArgs(),
)],
# Build a multi-platform image manifest for ARM and AMD.
platforms=[
docker_build.Platform.LINUX_AMD64,
],
# Push the final result to ECR.
push=True,
# Provide our ECR credentials.
registries=[docker_build.RegistryArgs(
address=ecr_repository.repository_url,
password=auth_token.password,
username=auth_token.user_name,
)],
)
image_uri = ecr_repository.repository_url.apply(lambda repository_url: f"{repository_url}:latest")
# Create the Lambda function using the Docker image
lambda_function = aws.lambda_.Function(
"generateEmbeddingLambda",
package_type="Image",
image_uri=image_uri,
role=lambda_role.arn,
timeout=300,
memory_size=2048,
architectures=["x86_64"],
)
quick-house-41860
10/29/2024, 9:18 PM"{repository_url}:latest"
. The underlying image changes, but the tag pointing to it doesn't.
The lambda function only sees the image_uri
, and because that doesn't change it's not triggering an update.
I'd recommend you to not use latest, but rather something like a semver tag or a hash generated from the docker context.