Skip to content

Commit

Permalink
Add tags in one statement in docker image generation
Browse files Browse the repository at this point in the history
  • Loading branch information
galeaspablo committed Sep 26, 2024
1 parent 76b565b commit e554b70
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions infrastructure/templates/application/docker_image.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ resource "null_resource" "push_app_image" {
ls -la
echo ${local.gcp_current_access_token_for_docker} | docker login -u oauth2accesstoken --password-stdin https://${local.docker_registry_url}
docker image pull ${local.docker_registry_url}/${local.docker_repository_name}:latest || true
docker build --build-arg SERVICE_NAME_IN_LOWERCASE=${var.full_service_name_in_lowercase} --tag ${local.docker_registry_url}/${local.docker_repository_name}:${random_id.image_tag.hex} .
docker build --build-arg SERVICE_NAME_IN_LOWERCASE=${var.full_service_name_in_lowercase} --tag ${local.docker_registry_url}/${local.docker_repository_name}:${random_id.image_tag.hex} --tag ${local.docker_registry_url}/${local.docker_repository_name}:latest .
docker image push ${local.docker_registry_url}/${local.docker_repository_name}:${random_id.image_tag.hex}
docker build --build-arg SERVICE_NAME_IN_LOWERCASE=${var.full_service_name_in_lowercase} --tag ${local.docker_registry_url}/${local.docker_repository_name}:latest .
docker image push ${local.docker_registry_url}/${local.docker_repository_name}:latest
cd ../../
rm docker_image_builder_${var.application_directory_name}_${random_id.image_tag.hex}/ -Rf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ resource "null_resource" "push_app_image" {
ls -la
echo ${local.gcp_current_access_token_for_docker} | docker login -u oauth2accesstoken --password-stdin https://${local.docker_registry_url}
docker image pull ${local.docker_registry_url}/${local.docker_repository_name}:latest || true
docker build --tag ${local.docker_registry_url}/${local.docker_repository_name}:${random_id.image_tag.hex} .
docker build --tag ${local.docker_registry_url}/${local.docker_repository_name}:${random_id.image_tag.hex} --tag ${local.docker_registry_url}/${local.docker_repository_name}:latest .
docker image push ${local.docker_registry_url}/${local.docker_repository_name}:${random_id.image_tag.hex}
docker build --tag ${local.docker_registry_url}/${local.docker_repository_name}:latest .
docker image push ${local.docker_registry_url}/${local.docker_repository_name}:latest
cd ../../
rm docker_image_builder_${var.application_directory_name}_${random_id.image_tag.hex}/ -Rf
Expand Down
3 changes: 1 addition & 2 deletions infrastructure/templates/pgt-proxy/docker_image.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ resource "null_resource" "push_image" {
ls -la
echo ${local.gcp_current_access_token_for_docker} | docker login -u oauth2accesstoken --password-stdin https://${local.docker_registry_url}
docker image pull ${local.docker_registry_url}/${local.docker_repository_name}:latest || true
docker build --tag ${local.docker_registry_url}/${local.docker_repository_name}:${random_id.image_tag.hex} .
docker build --tag ${local.docker_registry_url}/${local.docker_repository_name}:${random_id.image_tag.hex} --tag ${local.docker_registry_url}/${local.docker_repository_name}:latest .
docker image push ${local.docker_registry_url}/${local.docker_repository_name}:${random_id.image_tag.hex}
docker build --tag ${local.docker_registry_url}/${local.docker_repository_name}:latest .
docker image push ${local.docker_registry_url}/${local.docker_repository_name}:latest
cd ../
rm docker_image_builder_${random_id.image_tag.hex} -Rf
Expand Down

0 comments on commit e554b70

Please sign in to comment.