From b48a97ef5f3a7ebd1a286b6a3358cf14003aad82 Mon Sep 17 00:00:00 2001 From: Ziip-dev <62331138+Ziip-dev@users.noreply.github.com> Date: Mon, 20 May 2024 11:31:15 +0200 Subject: [PATCH 1/2] Pass `HUGO_ENV_ARG` to Hugo build in Dockerfile This aims to pass the build commit hash to Hugo so we can retrieve it and display it in the template footer. --- Dockerfiles/Dockerfile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Dockerfiles/Dockerfile b/Dockerfiles/Dockerfile index a8fa2fc6..0a850abf 100644 --- a/Dockerfiles/Dockerfile +++ b/Dockerfiles/Dockerfile @@ -2,15 +2,16 @@ FROM alpine:3.19.1 AS build RUN apk add --no-cache wget=1.21.4-r0 ARG HUGO_VERSION="0.123.7" +ARG HUGO_ENV_ARG +WORKDIR /src +COPY ./ /src RUN wget --quiet "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz" && \ tar xzf hugo_${HUGO_VERSION}_Linux-64bit.tar.gz && \ rm -r hugo_${HUGO_VERSION}_Linux-64bit.tar.gz && \ mv hugo /usr/bin && \ chmod 755 /usr/bin/hugo -WORKDIR /src -COPY ./ /src -RUN mkdir /target && \ - hugo -d /target + mkdir /target && \ + hugo -d /target -e "${HUGO_ENV_ARG}" # Serve the generated html using nginx FROM nginxinc/nginx-unprivileged:alpine From 0806260fb68f9091b1c0693af98fca370e151955 Mon Sep 17 00:00:00 2001 From: Paul <62331138+Ziip-dev@users.noreply.github.com> Date: Mon, 20 May 2024 12:31:42 +0200 Subject: [PATCH 2/2] Update Dockerfiles/Dockerfile Co-authored-by: Senthilkumar Panneerselvam --- Dockerfiles/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfiles/Dockerfile b/Dockerfiles/Dockerfile index 0a850abf..68599625 100644 --- a/Dockerfiles/Dockerfile +++ b/Dockerfiles/Dockerfile @@ -9,7 +9,7 @@ RUN wget --quiet "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VER tar xzf hugo_${HUGO_VERSION}_Linux-64bit.tar.gz && \ rm -r hugo_${HUGO_VERSION}_Linux-64bit.tar.gz && \ mv hugo /usr/bin && \ - chmod 755 /usr/bin/hugo + chmod 755 /usr/bin/hugo && \ mkdir /target && \ hugo -d /target -e "${HUGO_ENV_ARG}"