Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions modules/lambda-image-build/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ resource "null_resource" "build_and_push" {
interpreter = ["/bin/sh", "-c"]
command = <<-EOC
set -euo pipefail
# Use an ephemeral Docker config to avoid host keychain credential helper conflicts.
export DOCKER_CONFIG="$(mktemp -d)"
trap 'rm -rf "$DOCKER_CONFIG"' EXIT
aws ecr get-login-password --region ${data.aws_region.current.name} | docker login --username AWS --password-stdin ${data.aws_caller_identity.current.account_id}.dkr.ecr.${data.aws_region.current.name}.amazonaws.com
docker buildx build --platform ${var.platform} ${local.dockerfile_arg}-t ${aws_ecr_repository.lambda_image.repository_url}:${var.image_tag} ${var.source_dir}
docker push ${aws_ecr_repository.lambda_image.repository_url}:${var.image_tag}
Expand Down
3 changes: 3 additions & 0 deletions modules/lambda-image-public/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ resource "null_resource" "build_and_push" {
interpreter = ["/bin/sh", "-c"]
command = <<-EOC
set -euo pipefail
# Use an ephemeral Docker config to avoid host keychain credential helper conflicts.
export DOCKER_CONFIG="$(mktemp -d)"
trap 'rm -rf "$DOCKER_CONFIG"' EXIT
aws ecr-public get-login-password --region ${data.aws_region.current.name} | docker login --username AWS --password-stdin public.ecr.aws
docker buildx build --platform ${var.platform} -f ${var.dockerfile_path} -t ${aws_ecrpublic_repository.image.repository_uri}:${var.image_tag} ${var.build_context}
docker push ${aws_ecrpublic_repository.image.repository_uri}:${var.image_tag}
Expand Down
3 changes: 3 additions & 0 deletions modules/lambda-image-republish/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ resource "null_resource" "republish_image" {
interpreter = ["/bin/sh", "-c"]
command = <<-EOC
set -euo pipefail
# Use an ephemeral Docker config to avoid host keychain credential helper conflicts.
export DOCKER_CONFIG="$(mktemp -d)"
trap 'rm -rf "$DOCKER_CONFIG"' EXIT
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
aws ecr get-login-password --region ${data.aws_region.current.name} | docker login --username AWS --password-stdin ${data.aws_caller_identity.current.account_id}.dkr.ecr.${data.aws_region.current.name}.amazonaws.com
docker pull ${local.source_image_uri}
Expand Down