From 15a31da0721492039af094992811f17cca7be118 Mon Sep 17 00:00:00 2001 From: Greg Date: Sun, 1 Jun 2025 22:07:44 +0200 Subject: [PATCH] feat: install latest Hugo extended version from source in Alpine container --- Dockerfile | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9b147df..a92e026 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,20 @@ # Stage 1: Build the Hugo site -# Use the official Hugo Docker image (klakegg/hugo) which is always updated with the latest version -FROM klakegg/hugo:latest-ext AS builder +FROM alpine:3.19 AS builder -# Show Hugo version for build logs -RUN hugo version +# Install dependencies +RUN apk add --no-cache wget tar jq curl + +# Install latest Hugo extended version (with improved extraction) +RUN LATEST_RELEASE=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | jq -r '.tag_name') && \ + VERSION=${LATEST_RELEASE#v} && \ + echo "Installing latest Hugo version: $VERSION" && \ + wget -q https://github.com/gohugoio/hugo/releases/download/${LATEST_RELEASE}/hugo_extended_${VERSION}_linux-amd64.tar.gz -O hugo.tar.gz && \ + mkdir -p /tmp/hugo && \ + tar -xzf hugo.tar.gz -C /tmp/hugo && \ + mv /tmp/hugo/hugo /usr/local/bin/ && \ + chmod +x /usr/local/bin/hugo && \ + rm -rf /tmp/hugo hugo.tar.gz && \ + hugo version # Set the working directory in the container WORKDIR /src