Skip to content

Commit

Permalink
Merge pull request #983 from aws-observability/rapphil-chain-imagebui…
Browse files Browse the repository at this point in the history
…ld-commands

Chain imagebuild commands
  • Loading branch information
rapphil authored Dec 2, 2022
2 parents 1a92b8e + b2b6c4d commit a2bb600
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions terraform/imagebuild/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ resource "null_resource" "build_and_push_sample_apps" {

provisioner "local-exec" {
command = <<-EOT
docker buildx create --use --name sapbuilder.${count.index} --platform=linux/arm64,linux/amd64 --driver docker-container --bootstrap
docker buildx create --use --name sapbuilder.${count.index} --platform=linux/arm64,linux/amd64 --driver docker-container --bootstrap && \
docker buildx build --builder=sapbuilder.${count.index} --push --platform=linux/amd64,linux/arm64 -t ${data.aws_ecr_repository.sample_app.repository_url}:${dirname(element(local.sample_apps_dockerfile_list, count.index))}-latest ../../sample-apps/${dirname(element(local.sample_apps_dockerfile_list, count.index))}/
RESULT=$?
docker buildx rm sapbuilder.${count.index}
exit $RESULT
EOT
}

Expand All @@ -72,9 +74,11 @@ resource "null_resource" "build_and_push_mocked_server" {

provisioner "local-exec" {
command = <<-EOT
docker buildx create --use --name msgbuilder.${count.index} --platform=linux/arm64,linux/amd64 --driver docker-container --bootstrap
docker buildx create --use --name msgbuilder.${count.index} --platform=linux/arm64,linux/amd64 --driver docker-container --bootstrap && \
docker buildx build --builder=msgbuilder.${count.index} --push --platform=linux/amd64,linux/arm64 -t ${data.aws_ecr_repository.mocked_server.repository_url}:${dirname(element(local.mocked_servers_dockerfile_list, count.index))}-latest ../../mocked_servers/${dirname(element(local.mocked_servers_dockerfile_list, count.index))}/
RESULT=$?
docker buildx rm msgbuilder.${count.index}
exit $RESULT
EOT
}

Expand All @@ -87,4 +91,4 @@ output "sample_apps_dockerfile_list" {

output "mocked_servers_dockerfile_list" {
value = local.mocked_servers_dockerfile_list
}
}

0 comments on commit a2bb600

Please sign in to comment.