Hugo 等静态网站部署教程
示例:https://jetsung.fermyon.app
代码:https://git.jetsung.com/jetsung/blog
主要是增加了 Makefile
文件,此文件主要是编译和构建而已,不需要理会
.PHONY : start deploy
port = 3000
start:
hugo -D -b "http://127.0.0.1:$(port)/"
cd app && spin build && spin up --listen 127.0.0.1:$(port)
deploy:
hugo -b "/"
cd app && spin build && spin deploy
主要代码位于 app
目录下的文件
spin_manifest_version = 2
[application]
authors = ["Jetsung Chan <jetsungchan@gmail.com>"]
name = "jetsung"
description = ""
version = "0.1.0"
[[trigger.http]]
route = "/..."
component = "blog"
[component.blog]
source = { url = "https://github.com/fermyon/spin-fileserver/releases/download/v0.3.0/spin_static_fs.wasm", digest = "sha256:ef88708817e107bf49985c7cefe4dd1f199bf26f6727819183d5c996baa3d148" }
description = ""
files = [ { source = "../public", destination = "/" } ]
静态网站同理可以代替。
spin-fileserver:https://github.com/fermyon/spin-fileserver/releases
查看最新的版本和 sha256,并修改上述的代码。
../public
,则是静态网站代码位相对于 app
目录位置,位于主项目目录下的 public
下。