DodoApp: support Hugo static websites
Change-Id: Ie01f12443e81f3bfc9f7500d443a0399a1fe01ef
diff --git a/core/installer/app_configs/dodo_app.cue b/core/installer/app_configs/dodo_app.cue
index 409b5d4..39788a7 100644
--- a/core/installer/app_configs/dodo_app.cue
+++ b/core/installer/app_configs/dodo_app.cue
@@ -15,6 +15,20 @@
auth: #Auth
}
+#AppTmpl: {
+ type: string
+ ingress: #AppIngress
+ runConfiguration: [...#Command]
+ ...
+}
+
+#Command: {
+ bin: string
+ args: [...string] | *[]
+}
+
+// Go app
+
_goVer1220: "golang:1.22.0"
_goVer1200: "golang:1.20.0"
@@ -45,7 +59,28 @@
#GoApp: #GoApp1200 | #GoApp1220
-app: #GoApp
+// Hugo app
+
+_hugoLatest: "hugo:latest"
+
+#HugoAppTmpl: {
+ type: _hugoLatest
+ ingress: #AppIngress
+
+ runConfiguration: [{
+ bin: "/usr/bin/hugo",
+ args: []
+ }, {
+ bin: "/usr/bin/hugo",
+ args: ["server", "--port=\(_appPort)", "--bind=0.0.0.0"]
+ }]
+}
+
+#HugoApp: #HugoAppTmpl
+
+#App: #GoApp | #HugoApp
+
+app: #App
// output
@@ -89,8 +124,8 @@
tag: images.app.tag
pullPolicy: images.app.pullPolicy
}
- appPort: 8080
- appDir: "/dodo-app"
+ appPort: _appPort
+ appDir: _appDir
repoAddr: input.repoAddr
sshPrivateKey: base64.Encode(null, input.sshPrivateKey)
runCfg: base64.Encode(null, json.Marshal(_app.runConfiguration))
@@ -98,3 +133,6 @@
}
}
}
+
+_appDir: "/dodo-app"
+_appPort: 8080
diff --git a/core/installer/soft/repoio.go b/core/installer/soft/repoio.go
index b50bcaa..6df9dcd 100644
--- a/core/installer/soft/repoio.go
+++ b/core/installer/soft/repoio.go
@@ -188,6 +188,13 @@
if err := wt.AddGlob("*"); err != nil {
return err
}
+ st, err := wt.Status()
+ if err != nil {
+ return err
+ }
+ if len(st) == 0 {
+ return nil // TODO(gio): maybe return ErrorNothingToCommit
+ }
if _, err := wt.Commit(message, &git.CommitOptions{
Author: &object.Signature{
Name: "pcloud-installer",