antony@notes:~/container$ cat "Deploy-Hugo-using-Podman.md"
Deploy Hugo using Podman
Deploy Hugo using Podman
下載 hugo github repo
$ git clone https://github.com/gohugoio/hugo.gitBuild Container Image
$ cd hugo/ && sudo podman build --no-cache --squash-all --build-arg HUGO_BUILD_TAGS=extended -t hugo:v1-ext .
$ $ sudo podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost/hugo v1-ext-docsy 0785c267cc1f 9 seconds ago 205 MB設定網站
## 產生 hugo 網站的 Template (此命令會新增一個目錄區專門存放網站的檔案)
$ sudo podman run --rm --name hugo -v $(pwd):/site localhost/hugo:v1-ext new site bobo
## 檢視目錄結構
$ ls -l bobo/
total 36
drwxr-sr-x 2 root bigred 4096 Mar 6 16:42 archetypes -> # 定義content內容檔案的元資料
drwxr-sr-x 2 root bigred 4096 Mar 6 16:42 assets
drwxr-sr-x 2 root bigred 4096 Mar 6 16:42 content -> # 存放文章的內容
drwxr-sr-x 2 root bigred 4096 Mar 6 16:42 data
-rw-r--r-- 1 root bigred 83 Mar 6 16:42 hugo.toml -> # 網站的設定檔
drwxr-sr-x 2 root bigred 4096 Mar 6 16:42 i18n
drwxr-sr-x 2 root bigred 4096 Mar 6 16:42 layouts -> # 存放模板
drwxr-sr-x 2 root bigred 4096 Mar 6 16:42 static -> # 存放靜態資源,如圖片、JavaScript 和 CSS
drwxr-sr-x 2 root bigred 4096 Mar 6 16:42 themes -> # 網站的主題
## 使用 Docsy 主題
## Install Docsy as a Git submodule
$ cd bobo
$ sudo git init
$ sudo git config --global user.name "bobo"
$ sudo git config --global user.email "bobo@example.com"
$ sudo git submodule add https://github.com/google/docsy.git themes/docsy
$ sudo git submodule update --init --recursive
## 安裝 Docsy 相依檔
$ sudo apk add --update nodejs npm
$ cd themes/docsy && sudo npm install
## 將 docsy 預設的網站設定檔及相關檔案複製到專案根目錄下
$ cd -
$ sudo cp themes/docsy/userguide/hugo.yaml .
$ sudo cp -R themes/docsy/userguide/content/ .
$ sudo cp -R themes/docsy/userguide/layouts/ .
$ sudo cp -R themes/docsy/userguide/static/ .
## 啟動 hugo web server
$ sudo podman run --network=host \
--rm --name hugo \
-v $(pwd):/site/ \
localhost/hugo:v1-ext server --bind=192.168.61.128 --baseURL=http://192.168.61.128 --port=1313