47 lines
1.1 KiB
Terraform
47 lines
1.1 KiB
Terraform
|
data "docker_registry_image" "shit" {
|
||
|
name = "nginx:latest"
|
||
|
}
|
||
|
|
||
|
data "docker_network" "traefik" {
|
||
|
name = "traefik"
|
||
|
}
|
||
|
|
||
|
locals {
|
||
|
labels = {
|
||
|
"shepherd.auto-update" = "true",
|
||
|
"traefik.enable" = "true"
|
||
|
"traefik.http.services.shit.loadbalancer.server.port" = "80",
|
||
|
"traefik.http.routers.shit.rule" = "Host(`shit.montage2.de`)",
|
||
|
"traefik.http.routers.shit.tls" = "true",
|
||
|
"traefik.http.routers.shit.tls.certresolver" = "default",
|
||
|
}
|
||
|
}
|
||
|
|
||
|
resource "docker_service" "shit" {
|
||
|
name = "shit"
|
||
|
|
||
|
dynamic "labels" {
|
||
|
for_each = local.labels
|
||
|
content {
|
||
|
label = labels.key
|
||
|
value = labels.value
|
||
|
}
|
||
|
}
|
||
|
|
||
|
task_spec {
|
||
|
networks_advanced {
|
||
|
name = data.docker_network.traefik.id
|
||
|
}
|
||
|
|
||
|
container_spec {
|
||
|
image = "${data.docker_registry_image.shit.name}@${data.docker_registry_image.shit.sha256_digest}"
|
||
|
|
||
|
mounts {
|
||
|
target = "/usr/share/nginx/html/"
|
||
|
source = "/mnt/data/shit/html/"
|
||
|
type = "bind"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|