This repository has been archived on 2024-11-12. You can view files and clone it, but cannot push or open issues or pull requests.
iac/printers.tf

49 lines
1.1 KiB
Terraform
Raw Normal View History

2024-06-27 21:17:13 +00:00
resource "docker_image" "octoprint" {
2024-06-28 10:43:20 +00:00
provider = docker.printi
name = "octoprint"
2024-06-27 21:17:13 +00:00
build {
context = "${path.module}/printers"
2024-06-28 10:43:20 +00:00
target = "octoprint-mjpg-streamer"
2024-06-28 13:49:44 +00:00
tag = ["ti-octoprint:latest"]
2024-06-27 21:17:13 +00:00
}
}
2024-06-28 10:43:20 +00:00
resource "docker_volume" "ender5plus" {
provider = docker.printi
2024-06-28 13:49:44 +00:00
name = "ender5plus_config"
2024-06-28 10:43:20 +00:00
}
resource "docker_service" "ender5plus" {
provider = docker.printi
2024-06-28 13:49:44 +00:00
name = "ender5plus"
2024-06-28 10:43:20 +00:00
task_spec {
container_spec {
2024-06-28 15:53:53 +00:00
image = "${docker_image.octoprint.name}:latest"
2024-06-28 10:43:20 +00:00
mounts {
target = "/octoprint"
source = docker_volume.ender5plus.name
type = "volume"
}
mounts {
target = "/dev/ttyACM0"
source = "/dev/serial/by-id/usb-FTDI_FT232R_USB_UART_A602AFFK-if00-port0"
type = "bind"
}
env = {
#ENABLE_MJPG_STREAMER = "true"
}
}
restart_policy {
2024-06-28 13:49:44 +00:00
condition = "any"
delay = "20s"
window = "0s"
2024-06-28 10:43:20 +00:00
}
}
endpoint_spec {
ports {
target_port = 80
published_port = 3000
publish_mode = "ingress"
}
}
}