resource "docker_image" "octoprint" {
provider = docker.printi
name = "octoprint"
build {
context = "${path.module}/printers"
target = "octoprint-mjpg-streamer"
tag = ["ti-octoprint:latest"]
}
resource "docker_volume" "ender5plus" {
name = "ender5plus_config"
resource "docker_service" "ender5plus" {
name = "ender5plus"
task_spec {
container_spec {
image = "${docker_image.octoprint.name}:latest"
mounts {
target = "/octoprint"
source = docker_volume.ender5plus.name
type = "volume"
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 {
condition = "any"
delay = "20s"
window = "0s"
endpoint_spec {
ports {
target_port = 80
published_port = 3000
publish_mode = "ingress"