-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker_image build image even if file context and dockerfile doesn't change #571
Comments
I found that the build will be retriggered if the content of (file, subfolder, etc) your context folder change, which makes sense because the provider does not know which file in the context folder will be used (e.g |
In my case the build is triggered even if the content has not changed. I suspect that it's |
I've also come across this bug. Our use case was to build an image from a dockerfile in a folder resource "docker_registry_image" "registry_image" {
name = docker_image.image.name
}
resource "docker_image" "image" {
name = "${aws_ecr_repository.repository.repository_url}:latest"
build {
context = "${path.module}/src/example"
}
triggers = {
dir_sha1 = sha1(join("", [for f in fileset(path.module, "src/example/**") : filesha1(f)]))
}
} Our solution was to rollback to version 2.25.0 of kreuzwerker/docker. (note the above configuration needs changing for this version). |
I guess quite a few of us are currently sitting on 2.25.0 because of this. See also #555 |
@enc In addition this issue there are also #555 and #607 all the same problem might be good to have them in one place and close duplicates... This issue described in comment by samuelcortinhas is really annoying with CI deployments because virtual machine that runs terraform starts with clean local docker registry so |
I opened #607. @samuelcortinhas I had to update to v3+ becuase v2.5.0 started to throw errors out of nothing. Does it still work for you? I guess I will have to give it a try again because with this bug I am keep rebuilding stuff for nothing. I am using AWS ECR too. |
Boh, I downgraded to I guess we will never update it. :D |
That's weird, I have the opposite problem #647 |
I am using the terraform-aws-modules/lambda/aws module for creating lambdas and the docker-build module for creating the docker image. I had the same problem, fixed it with downloading the docker-build module and adding it directly in my project, changing the version for "kreuzwerker/docker" to "2.25.0" and modifying the main.tf to use the docker_registry_image resource instead of the docker_image.
And it worked perfectly. |
@kiril-pcg @enc Thanks for your response. I will try your solution even if a permanent fix will be better |
Community Note
Terraform (and docker Provider) Version
Affected Resource(s)
docker_image
Terraform Configuration Files
Debug Output
Panic Output
Expected Behaviour
Don't build and deploy if context and dockerfile doesn't change
Actual Behaviour
Build and Deploy at each terraform apply
Steps to Reproduce
terraform apply
Important Factoids
References
The text was updated successfully, but these errors were encountered: