Skip to content

Instantly share code, notes, and snippets.

@hendrixroa
Created March 24, 2023 15:56
Show Gist options
  • Save hendrixroa/6abf9e1e00a6c503f53dc4df698099da to your computer and use it in GitHub Desktop.
Save hendrixroa/6abf9e1e00a6c503f53dc4df698099da to your computer and use it in GitHub Desktop.
Packaging ecr docker images
resource "null_resource" "docker_packaging" {
provisioner "local-exec" {
command = <<EOF
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${data.aws_caller_identity.current.account_id}.dkr.ecr.us-east-1.amazonaws.com
gradle build -p noiselesstech
docker build -t "${aws_ecr_repository.noiselesstech.repository_url}:latest" -f noiselesstech/Dockerfile .
docker push "${aws_ecr_repository.noiselesstech.repository_url}:latest"
EOF
}
triggers = {
"run_at" = timestamp()
}
depends_on = [
aws_ecr_repository.noiselesstech,
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment