From 87ac8db7ed2359c765d3c43284c79163cedd0225 Mon Sep 17 00:00:00 2001
From: d3vyce <nicolas.sudres@hotmail.fr>
Date: Sun, 11 Feb 2024 11:28:25 +0100
Subject: [PATCH] add hugo build image

---
 .gitea/workflows/build_hugo_image.yml | 36 +++++++++++++++++++++++++++
 .gitignore                            |  1 +
 README.md                             |  3 ++-
 hugo.Dockerfile                       | 10 ++++++++
 4 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 .gitea/workflows/build_hugo_image.yml
 create mode 100644 hugo.Dockerfile

diff --git a/.gitea/workflows/build_hugo_image.yml b/.gitea/workflows/build_hugo_image.yml
new file mode 100644
index 0000000..dcc5633
--- /dev/null
+++ b/.gitea/workflows/build_hugo_image.yml
@@ -0,0 +1,36 @@
+name: Build Hugo Docker Image
+
+on:
+  push:
+    branches:
+      - main
+
+jobs:
+  build docker:
+    runs-on: linux_amd
+    steps:
+      - name: checkout code
+        uses: actions/checkout@v3
+      - name: Get changed files
+        id: changed-files
+        uses: tj-actions/changed-files@v42
+        with:
+          files: hugo.Dockerfile
+      - name: Set up QEMU
+        uses: docker/setup-qemu-action@v2
+      - name: Set up Docker Buildx
+        uses: docker/setup-buildx-action@v2
+      - name: Login to Docker registry
+        uses: docker/login-action@v2
+        with:
+          registry: git.d3vyce.fr
+          username: ${{ github.actor }}
+          password: ${{ secrets.GIT_TOKEN }}
+      - name: Build and push
+        uses: docker/build-push-action@v4
+        with:
+          context: .
+          file: ./hugo.Dockerfile
+          platforms: linux/amd64
+          push: true
+          tags: git.d3vyce.fr/d3vyce/hugo:latest
diff --git a/.gitignore b/.gitignore
index d2f2afc..1f3b413 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
 # Hugo and Blowfish
 resources
+public
 
 #others
 node_modules
diff --git a/README.md b/README.md
index 6a4c32f..998e9c4 100644
--- a/README.md
+++ b/README.md
@@ -2,5 +2,6 @@
 ## Install
 
 ```
-
+CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@latest
+git submodule update --recursive
 ```
\ No newline at end of file
diff --git a/hugo.Dockerfile b/hugo.Dockerfile
new file mode 100644
index 0000000..262a294
--- /dev/null
+++ b/hugo.Dockerfile
@@ -0,0 +1,10 @@
+FROM golang:1.22-alpine AS build
+
+ARG CGO=1
+ENV CGO_ENABLED=${CGO}
+ENV GOOS=linux
+ENV GO111MODULE=on
+
+RUN apk update && \
+    apk add --no-cache gcc musl-dev g++ git
+RUN go install -tags extended github.com/gohugoio/hugo@v0.122.0