diff --git a/files/makefile-cpu-arch.tpl b/files/makefile-cpu-arch.tpl index 3f0b6f0..08847fc 100644 --- a/files/makefile-cpu-arch.tpl +++ b/files/makefile-cpu-arch.tpl @@ -26,6 +26,7 @@ dist-dev: check-arch ## Build docker container (intended for developer-based man docker buildx use $(ECR_NAME_DEV); \ docker buildx build --platform $(CPU_ARCH) \ --load \ + --tag $(ECR_URL_DEV):$$ARCH_TAG \ --tag $(ECR_URL_DEV):make-$$ARCH_TAG \ --tag $(ECR_URL_DEV):make-$(shell git describe --always) \ --tag $(ECR_NAME_DEV):$$ARCH_TAG \ @@ -34,9 +35,11 @@ dist-dev: check-arch ## Build docker container (intended for developer-based man publish-dev: dist-dev ## Build, tag and push (intended for developer-based manual publish) @ARCH_TAG=$$(cat .arch_tag); \ aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $(ECR_URL_DEV); \ + docker push $(ECR_URL_DEV):$$ARCH_TAG; \ docker push $(ECR_URL_DEV):make-$$ARCH_TAG; \ docker push $(ECR_URL_DEV):make-$(shell git describe --always); \ - docker push $(ECR_URL_DEV):make-$(shell echo $(CPU_ARCH) | cut -d'/' -f2) + echo "Cleaning up dangling Docker images..."; \ + docker image prune -f --filter "dangling=true" ### If this is a Lambda repo, uncomment the two lines below ### # update-lambda-dev: ## Updates the lambda with whatever is the most recent image in the ecr (intended for developer-based manual update) @@ -49,9 +52,9 @@ publish-dev: dist-dev ## Build, tag and push (intended for developer-based manua docker-clean: ## Clean up Docker detritus @ARCH_TAG=$$(cat .arch_tag); \ echo "Cleaning up Docker leftovers (containers, images, builders)"; \ + docker rmi -f $(ECR_URL_DEV):$$ARCH_TAG; \ docker rmi -f $(ECR_URL_DEV):make-$$ARCH_TAG; \ docker rmi -f $(ECR_URL_DEV):make-$(shell git describe --always) || true; \ - docker rmi -f $(ECR_URL_DEV):make-$(shell echo $(CPU_ARCH) | cut -d'/' -f2) || true; \ docker rmi -f $(ECR_NAME_DEV):$$ARCH_TAG || true; \ docker buildx rm $(ECR_NAME_DEV) || true @rm -rf .arch_tag diff --git a/timdex_ecrs.tf b/timdex_ecrs.tf index 69d954c..be33ee6 100644 --- a/timdex_ecrs.tf +++ b/timdex_ecrs.tf @@ -258,14 +258,10 @@ module "ecr_timdex_browsertrix" { app-repo = "timdex-infrastructure-browsertrix" } } -# NEED TO FIX THE MISSPELLING!!! -moved { - from = module.ecr_timdex_broswertrix - to = module.ecr_timdex_browsertrix -} + # Outputs in dev output "browsertrix_dev_build_workflow" { - value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/dev-build.tpl", { + value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/dev-build-cpu-arch.tpl", { region = var.aws_region role = module.ecr_timdex_browsertrix.gha_role ecr = module.ecr_timdex_browsertrix.repository_name @@ -274,13 +270,9 @@ output "browsertrix_dev_build_workflow" { ) description = "Full contents of the dev-build.yml for the browsertrix-harvester repo" } -# NEED TO FIX THE MISSPELLING!!! -moved { - from = output.broswertrix_dev_build_workflow - to = output.browsertrix_dev_build_workflow -} + output "browsertrix_makefile" { - value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile.tpl", { + value = var.environment == "prod" || var.environment == "stage" ? null : templatefile("${path.module}/files/makefile-cpu-arch.tpl", { ecr_name = module.ecr_timdex_browsertrix.repository_name ecr_url = module.ecr_timdex_browsertrix.repository_url function = "" @@ -288,14 +280,10 @@ output "browsertrix_makefile" { ) description = "Full contents of the Makefile for the browsertrix-harvester repo (allows devs to push to Dev account only)" } -# NEED TO FIX THE MISSPELLING!!! -moved { - from = output.broswertrix_makefile - to = output.browsertrix_makefile -} + # Outputs in stage output "browsertrix_stage_build_workflow" { - value = var.environment == "prod" || var.environment == "dev" ? null : templatefile("${path.module}/files/stage-build.tpl", { + value = var.environment == "prod" || var.environment == "dev" ? null : templatefile("${path.module}/files/stage-build-cpu-arch.tpl", { region = var.aws_region role = module.ecr_timdex_browsertrix.gha_role ecr = module.ecr_timdex_browsertrix.repository_name @@ -304,14 +292,10 @@ output "browsertrix_stage_build_workflow" { ) description = "Full contents of the stage-build.yml for the browsertrix-harvester repo" } -# NEED TO FIX THE MISSPELLING!!! -moved { - from = output.broswertrix_stage_build_workflow - to = output.browsertrix_stage_build_workflow -} + # Outputs after promotion to prod output "browsertrix_prod_promote_workflow" { - value = var.environment == "stage" || var.environment == "dev" ? null : templatefile("${path.module}/files/prod-promote.tpl", { + value = var.environment == "stage" || var.environment == "dev" ? null : templatefile("${path.module}/files/prod-promote-cpu-arch.tpl", { region = var.aws_region role_stage = "${module.ecr_timdex_browsertrix.repo_name}-gha-stage" role_prod = "${module.ecr_timdex_browsertrix.repo_name}-gha-prod" @@ -322,11 +306,6 @@ output "browsertrix_prod_promote_workflow" { ) description = "Full contents of the prod-promote.yml for the browsertrix-harvester repo" } -# NEED TO FIX THE MISSPELLING!!! -moved { - from = output.broswertrix_prod_promote_workflow - to = output.browsertrix_prod_promote_workflow -} ## geo-harvester