profileRyan KesPGP keyI build stuffEmailGithubTwitterLast.fmMastodon

Alpine-Hugo-Surge.sh-Git-Bash Docker Image

Commit badgeLayers badgeVersion badge

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 deployment time to a minimum I've created a docker image with all the tools I need to build and deploy this site. Namely:

The Dockerfile itself is nothing shocking:

FROM mhart/alpine-node:latest
MAINTAINER Ryan Kes <ryan@andthensome.nl>

ENV HUGO*VERSION 0.16
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 https://github.com/spf13/hugo/releases/download/v${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

# Install surge client

RUN npm install -g surge

A comparison of image sizes & build/deploy speeds :

ImageSizeBuild DurationDeploy DurationTotal Duration
nodesource/trusty62.8 MB55s33s1m28s
andthensome/alpine-hugo-surge-git-bash49.9 MB25s26s51s

While 37 seconds per deployment saved might not sound like a huge deal, every second does count when it comes to continuous automated deployment (Wercker, you're welcome).