From 9fb25eccd33ca2e57aff3f9986e7365580e6485b Mon Sep 17 00:00:00 2001 From: Abdullah Aziz Date: Mon, 25 Nov 2024 16:02:39 +0100 Subject: [PATCH] updating dockerfile to fix URI issue --- Dockerfiles/Dockerfile | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Dockerfiles/Dockerfile b/Dockerfiles/Dockerfile index d7e0ac2..d5b43ac 100644 --- a/Dockerfiles/Dockerfile +++ b/Dockerfiles/Dockerfile @@ -1,6 +1,23 @@ -FROM klakegg/hugo:0.104.3-ubuntu-onbuild AS build +# Use alpine Linux, download desired version of HUGO and build html files +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 && \ + mkdir /target && \ + hugo -d /target -e "${HUGO_ENV_ARG}" +# Serve the generated html using nginx FROM nginxinc/nginx-unprivileged:alpine +RUN sed -i '3 a\ absolute_redirect off;' /etc/nginx/conf.d/default.conf && \ + sed -i '4 a\ add_header X-Frame-Options DENY always;' /etc/nginx/conf.d/default.conf && \ + sed -i 's/#error_page 404/error_page 404/' /etc/nginx/conf.d/default.conf COPY --from=build /target /usr/share/nginx/html -EXPOSE 8080 +EXPOSE 8080 \ No newline at end of file