Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update main.tf
  • Loading branch information
matifali authored Jan 5, 2024
commit 7f2b357e90059d84ce6eed0d4359afca5df627a0
21 changes: 9 additions & 12 deletions dogfood/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ data "coder_parameter" "region" {

provider "docker" {
host = lookup(local.docker_host, data.coder_parameter.region.value)
registry_auth {
address = var.jfrog_url
username = module.jfrog.username
password = module.jfrog.access_token
}
}

provider "coder" {}
Expand Down Expand Up @@ -283,16 +278,18 @@ resource "docker_volume" "home_volume" {
}
}

resource "null_resource" "update_trigger" {
triggers = {
always_run = "${timestamp()}"
}
data "docker_registry_image" "dogfood" {
name = "${local.registry_name}:latest"
}

resource "docker_image" "dogfood" {
name = "${local.jfrog_host}/docker/${local.registry_name}:latest"
pull_triggers = [null_resource.update_trigger.id]
keep_locally = true
name = "${local.registry_name}@${data.docker_registry_image.dogfood.sha256_digest}"
pull_triggers = [
data.docker_registry_image.dogfood.sha256_digest,
sha1(join("", [for f in fileset(path.module, "files/*") : filesha1(f)])),
filesha1("Dockerfile"),
]
keep_locally = true
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was not working nicely with a private docker registry, so I had to resort to this hack,
I filed an issue with the docker provider.
kreuzwerker/terraform-provider-docker#593

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also not working, and terraform is not pulling the latest image even though Artifactory has it.
There are open issues regarding this: kreuzwerker/terraform-provider-docker#172

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can skip pulling from the satisfactory in Terraform or use a new tag on each build. Probably short git sha.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After talking to @Emyrk, we decided not to use Artifactory to fetch pull docker image.


resource "docker_container" "workspace" {
Expand Down