update: hugo migration article
All checks were successful
Build Blog Docker Image / build docker (push) Successful in 1m13s

This commit is contained in:
d3vyce 2024-02-24 13:43:02 +01:00
parent e7625c38a3
commit 42d472e350
11 changed files with 72 additions and 17 deletions

BIN
content/posts/migrate-from-ghost-to-hugo/featured.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
content/posts/migrate-from-ghost-to-hugo/featured.webp (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
content/posts/migrate-from-ghost-to-hugo/img/image-3.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
content/posts/migrate-from-ghost-to-hugo/img/image-3.webp (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -14,6 +14,8 @@ I've had a blog since early 2022. Historically, I chose Ghost to make this site.
- Simple, modern theme
- Regular updates
![Ghost based blog](img/image-1.webp)
But after using it for quite some time, a number of problems have arisen that can't really be corrected:
- Limited customization
- Complex theme modification if you want to be able to update it afterwards
@ -59,6 +61,7 @@ git lfs migrate \
### CI/CD
#### Hugo docker image
hugo.Dockerfile:
```dockerfile
FROM golang:1.22-alpine AS build
@ -70,14 +73,47 @@ 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
```
I then use the following commands to build the Hugo image:
```
docker build -t git.d3vyce.fr/d3vyce/hugo:latest -f hugo.Dockerfile .
docker push git.d3vyce.fr/d3vyce/hugo:latest
RUN go install -tags extended github.com/gohugoio/hugo@v0.123.3
```
```yml
name: Build Hugo Docker Image
on:
push:
paths:
- "hugo.Dockerfile"
jobs:
build docker:
runs-on: linux_amd
steps:
- name: checkout code
uses: actions/checkout@v3
- 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
```
#### Blog docker image
Dockerfile:
```dockerfile
# Build Stage
@ -86,7 +122,8 @@ FROM git.d3vyce.fr/d3vyce/hugo:latest AS build
WORKDIR /opt/blog
COPY . /opt/blog/
RUN git submodule update --init --recursive
RUN git submodule update --init --recursive && \
git -C themes/blowfish/ checkout v2.58.0
RUN hugo
# Publish Stage
@ -149,10 +186,10 @@ Après avoir terminé la migration, j'ai comparé les 2 solutions.
### Performance
Lighthouse result for Ghost based blog:
![Ghost based blog lighthouse result](img/image-1.webp)
![Ghost based blog lighthouse result](img/image-2.webp)
Lighthouse result for Hugo based blog:
![Hugo based blog lighthouse result](img/image-2.webp)
![Hugo based blog lighthouse result](img/image-3.webp)
| Metric | Ghost (Dawn) | Hugo (Blowfish) |
|--------------------------|--------------|-----------------|

Binary file not shown.

Binary file not shown.