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

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

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 - Simple, modern theme
- Regular updates - 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: But after using it for quite some time, a number of problems have arisen that can't really be corrected:
- Limited customization - Limited customization
- Complex theme modification if you want to be able to update it afterwards - Complex theme modification if you want to be able to update it afterwards
@@ -59,6 +61,7 @@ git lfs migrate \
### CI/CD ### CI/CD
#### Hugo docker image
hugo.Dockerfile: hugo.Dockerfile:
```dockerfile ```dockerfile
FROM golang:1.22-alpine AS build FROM golang:1.22-alpine AS build
@@ -70,14 +73,47 @@ ENV GO111MODULE=on
RUN apk update && \ RUN apk update && \
apk add --no-cache gcc musl-dev g++ git apk add --no-cache gcc musl-dev g++ git
RUN go install -tags extended github.com/gohugoio/hugo@v0.122.0 RUN go install -tags extended github.com/gohugoio/hugo@v0.123.3
```
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
``` ```
```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:
```dockerfile ```dockerfile
# Build Stage # Build Stage
@@ -86,7 +122,8 @@ FROM git.d3vyce.fr/d3vyce/hugo:latest AS build
WORKDIR /opt/blog WORKDIR /opt/blog
COPY . /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 RUN hugo
# Publish Stage # Publish Stage
@@ -149,10 +186,10 @@ Après avoir terminé la migration, j'ai comparé les 2 solutions.
### Performance ### Performance
Lighthouse result for Ghost based blog: 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: 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) | | Metric | Ghost (Dawn) | Hugo (Blowfish) |
|--------------------------|--------------|-----------------| |--------------------------|--------------|-----------------|