refactor: simplify Dockerfile by using official Hugo image instead of custom build
This commit is contained in:
parent
a9be46421d
commit
26a8d78461
19
Dockerfile
19
Dockerfile
@ -1,20 +1,9 @@
|
|||||||
# Stage 1: Build the Hugo site
|
# Stage 1: Build the Hugo site
|
||||||
FROM alpine:3.19 AS builder
|
# Use the official Hugo Docker image (klakegg/hugo) which is always updated with the latest version
|
||||||
|
FROM klakegg/hugo:latest-ext AS builder
|
||||||
|
|
||||||
# Install dependencies
|
# Show Hugo version for build logs
|
||||||
RUN apk add --no-cache wget tar jq curl
|
RUN hugo version
|
||||||
|
|
||||||
# Install latest Hugo extended version
|
|
||||||
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 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/ && \
|
|
||||||
rm -rf /tmp/hugo hugo.tar.gz && \
|
|
||||||
chmod +x /usr/local/bin/hugo && \
|
|
||||||
hugo version
|
|
||||||
|
|
||||||
# Set the working directory in the container
|
# Set the working directory in the container
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user