Overengineering this blog

Since I was added blogroll pages with RSS stuffs and reading about Tech news via lobste.rs and hckernews , It was gimme cool inspiration and care about simple things that can be works/done. Back then i was ever tweeted this:


Because of that tweet, make feel attacked want to write more about something that I personally maintain till now (aka this blog site). So in my current condition and perspective, it related to “it’s okay to not know everything” or something higher condition level is “just enjoy the process”.

(Enough, let’s continue technically ways!)

What i have done

Tweaking stuffs

Multistage Dockerfile

Split with common name build and runtime. No deep technical reason behind this but I guess Multistage it’s already common used and standard to keep minimize container size :))

# Build Mode
FROM node:${NODE_VERSION}-alpine${ALPINE_VERSION} as builder

# Download and install hugo
RUN wget -O - https://github.com/gohugoio/hugo/releases/download/v${VERSION}/hugo_${VERSION}_Linux-64bit.tar.gz | tar -xz -C /tmp \
    ... \

# Do more stuffs

RUN npm install --production # god please 😐
RUN hugo --minify -b ${HUGO_BASE_URL} --environment production

# Runtime Mode
FROM nginxinc/nginx-unprivileged:${NGINX_VERSION}-alpine # IYKYK πŸ˜‰
COPY --from=builder /usr/share/blog/public /usr/share/nginx/html

# Do more stuffs

Repository structure

Currently, i dont’ have any idea about the technical reason for this case, but i just follow what common/current git(hub,lab) ways especially to place CI/CD config stores. But i have so curious about how to design or structure “monorepo” pattern.

Hail Makefile!

β”œβ”€β”€ .gitlab/
β”‚   β”œβ”€β”€ pipelines/
β”‚   β”‚   β”œβ”€β”€ docker-build.yml
β”‚   β”‚   └── docker-deploy.yml
β”‚   └── ...
β”œβ”€β”€ config/
β”‚   └── nginx.conf
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ archetypes
β”‚   └── content
β”œβ”€β”€ .gitlab-ci.yml
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ Makefile


This is what it looks like when adapt new repository structure and actually my ideas it’s split each stages then store it into .gitlab/ directory then call them with the include: keyword.

(This is nicely feature when you having many repository that adapt same condition stages or pattern => Tbh using this ways in my workplace)

  - test
  - build
  - deploy

  - template: Security/Secret-Detection.gitlab-ci.yml
  - template: SAST.gitlab-ci.yml
  - '/.gitlab/pipelines/docker-build.yml'
  - '/.gitlab/pipelines/docker-deploy.yml'

  HUGO_BASE_URL: https://blog.riskiwah.xyz

  extends: .build_container
    - master

  extends: .deploy-ssh
    - master

Nginx tweak and better 404 page

Tweak about simple CDN (it’s not really distributed) usage. Can read it through A journey static assets web server: Part 1 .

title: Whoops! Page not found
noindex: true
layout: page

Shake up part

I hate .js but ok lah for this as long as we keep simple and keep small Β―\_(ツ)_/Β―

Also this only happen if passed with env variable == production.

const purgecss = require('@fullhuman/postcss-purgecss')({
  content: ['./hugo_stats.json'],
  defaultExtractor: content => {
    const els = JSON.parse(content).htmlElements;
    return [
      ...(els.tags || []),
      ...(els.classes || []),
      ...(els.ids || []),
  safelist: []

module.exports = {
  plugins: [
    ...(process.env.HUGO_ENVIRONMENT === 'production' ? [purgecss] : [])

Personally i dont know it’s working well or not and yeah below is the result after executing .js scripts.

Closing thought

Well this is my another weird writing about overengineering blog in addition to tech stuff's related, it’s good to me to explore more about platform base especially gitlab feature and generally what i got is keep learning while you busy on works πŸ˜‚ πŸ˜‚ πŸ˜‚.