Misframe

Dec 25, 2016

Building a Hugo site using GitLab CI

Using GitLab CI and a Hugo Docker image, you can build static sites automatically and create tar.gz artifacts to deploy straight to production. GitLab CI can use images from various registries, including Docker Hub. I’m using the jojomi/hugo Docker image.

Here’s the .gitlab-ci.yml file you need:

image: jojomi/hugo:latest

stages:
  - build

build-site:
  stage: build
  script:
    - hugo
    - tar -cvzf site.tar.gz public
  artifacts:
    paths:
      - site.tar.gz
Next read these: