Alpine-Hugo-Git-Bash Docker Image


I use wercker to automatically deploy this site. One of the nice things about wercker is that it allows for you use docker images in your builds. To keep build time to a minimum I’ve created a docker image with all the tools I need to build this site. Namely:

The Dockerfile itself is nothing shocking:

FROM alpine:latest
MAINTAINER Ryan Kes <[email protected]>

ENV HUGO_BINARY hugo_${HUGO_VERSION}_linux-64bit

# Install pygments (for syntax highlighting)
RUN apk update && apk add py-pygments && apk add git && apk add bash && rm -rf /var/cache/apk/*

# Download and Install hugo
ADD${HUGO_VERSION}/${HUGO_BINARY}.tgz /usr/local/
RUN tar xzf /usr/local/${HUGO_BINARY}.tgz -C /usr/local/bin/ \
	&& rm /usr/local/${HUGO_BINARY}.tgz

A comparison of image sizes & build speeds :

Image Size Build Duration
nodesource/trusty 62.8 MB 55s
andthensome/alpine-hugo-git-bash 33.4 MB 29s