VuePress Build and Git

VuePress
Build
Bitbucket
Pipelines
Git
Docker
Posted on October 27th, 2018

Problem

VuePress default theme is full of great features: Navbar, Sidebar, a built-in search box, etc. One other neat feature is Last Updated.

From VuePress Last Updated docs:

The themeConfig.lastUpdated option allows you to get the UNIX timestamp(ms) of each file's last git commit, and it will also display at the bottom of each page in an appropriate format.

This feature is really useful to see if the page content has been updated recently.

I decided lately to add this option to my website. However, there was an error in Bitbucket Pipelines when I pushed that option to master.

alt Bitbucket Pipelines build error

After some reflexion and some research, I realized that the build couldn't succeed, because the docker image doesn't have Git installed. Thus, VuePress couldn't get the last Git commit timestamp.

Solution

The solution was simply to update the Dockerfile for my build image to install Git.

My Docker image is based from Alpine Linux. The command to add Git on this environment is pretty straigforward: apk add git. It results in the following Dockerfile.

FROM node:8.12-alpine

RUN apk add git

RUN npm install -g vuepress@0.14.4
RUN npm install -g firebase-tools@5.0.1

You can find the image on DockerHub: dspringuel/vuepress-firebase-git.

Author's Picture

Damien Springuel

Software Developer

Saskatoon, SK, Canada
If you have any questions, comments, or feedback regarding this post, you can contact me at contact@damien-springuel.ca.
Last Updated: 10/27/2018, 8:08:14 PM