Update Coder docker files

This commit is contained in:
2026-06-07 12:52:48 -04:00
parent 10da53dea1
commit 583ade52e3
3 changed files with 73 additions and 30 deletions
+27 -3
View File
@@ -27,6 +27,28 @@ data "coder_provisioner" "me" {}
data "coder_workspace" "me" {}
data "coder_workspace_owner" "me" {}
data "coder_parameter" "gpu" {
name = "gpu"
display_name = "GPU Assignment"
description = "Which GPU(s) to attach. GPU 1 is shared with Ollama and Immich, so GPU 0 is the default to avoid contention."
default = "0"
mutable = true
icon = "/icon/memory.svg"
option {
name = "GPU 0 only"
value = "0"
}
option {
name = "GPU 1 only (shared with Ollama and Immich)"
value = "1"
}
option {
name = "Both GPUs"
value = "all"
}
}
resource "coder_agent" "main" {
arch = data.coder_provisioner.me.arch
os = "linux"
@@ -51,6 +73,7 @@ resource "coder_agent" "main" {
GIT_AUTHOR_EMAIL = "${data.coder_workspace_owner.me.email}"
GIT_COMMITTER_NAME = coalesce(data.coder_workspace_owner.me.full_name, data.coder_workspace_owner.me.name)
GIT_COMMITTER_EMAIL = "${data.coder_workspace_owner.me.email}"
OLLAMA_HOST = "http://host.docker.internal:11434"
}
metadata {
@@ -163,12 +186,13 @@ resource "docker_container" "workspace" {
EOT
]
gpus = "all"
gpus = data.coder_parameter.gpu.value == "all" ? "all" : "device=${data.coder_parameter.gpu.value}"
env = [
"CODER_AGENT_TOKEN=${coder_agent.main.token}",
"NVIDIA_VISIBLE_DEVICES=0,1",
"NVIDIA_DRIVER_CAPABILITIES=all"
"NVIDIA_VISIBLE_DEVICES=${data.coder_parameter.gpu.value}",
"NVIDIA_DRIVER_CAPABILITIES=all",
"OLLAMA_HOST=http://host.docker.internal:11434"
]
host {