Add CI/CD for auto-deployment of blog
All checks were successful
Build and Push Docker Image / build (push) Successful in 3m23s

This commit is contained in:
2026-04-15 16:37:12 -07:00
parent b96f7ed3f0
commit f3eb83bcc0
4 changed files with 324 additions and 0 deletions

54
blog.nomad.hcl Normal file
View File

@@ -0,0 +1,54 @@
# export to json for ci/cd scripts with the following command
# nomad job run -output blog.nomad.hcl > blog.nomad.json
locals {
HOST = "cbraaten.dev"
}
variable "image_tag" {
type = string
default = "latest"
}
job "blog" {
type = "service"
group "blog" {
count = 1
network {
port "http" {
to = 3000
}
}
service {
name = "blog"
provider = "consul"
port = "http"
tags = [
"traefik.enable=true",
"traefik.http.routers.domainredirect.tls=true",
"traefik.http.routers.domainredirect.entrypoints=websecure",
"traefik.http.routers.domainredirect.rule=Host(`${local.HOST}`)",
]
}
task "blog" {
driver = "docker"
config {
image = "git.cbraaten.dev/caleb/blog:${var.image_tag}"
ports = ["http"]
}
}
update {
max_parallel = 1
min_healthy_time = "10s"
healthy_deadline = "3m"
auto_revert = true
}
}
}