From 246ba7bf079b278501fcb9baf23753bd4010f8b7 Mon Sep 17 00:00:00 2001 From: Vezpi Date: Wed, 16 Sep 2026 10:55:40 +0200 Subject: [PATCH] feat: use persistent hugo resources folder (#15) Reviewed-on: https://git.vezpi.com/Vezpi/Blog/pulls/15 --- docker/entrypoint.sh | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index f5478c7..a662606 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -5,7 +5,8 @@ set -e REPO_URL="${REPO_URL:-https://git.vezpi.com/Vezpi/blog.git}" URL="${URL:-blog.vezpi.com}" BRANCH="${BRANCH:-preview}" -CLONE_DIR="${CLONE_DIR:-/blog}" +BLOG_DIR="${BLOG_DIR:-/blog}" +HUGO_RESOURCES_DIR="${HUGO_RESOURCES_DIR:-/hugo-resources}" DRAFTS="" # Add drafts for preview @@ -15,15 +16,27 @@ if [ "$BRANCH" = "preview" ]; then fi # Clean blog dir -rm -rf "$CLONE_DIR" +rm -rf "$BLOG_DIR" # Clone repo echo "- Cloning $REPO_URL (branch: $BRANCH)..." -git clone --recurse-submodules --branch "$BRANCH" "$REPO_URL" "$CLONE_DIR" +git clone --recurse-submodules --branch "$BRANCH" "$REPO_URL" "$BLOG_DIR" + +# Restore persistent Hugo resources cache +rm -rf "$BLOG_DIR/resources" +ln -s "$HUGO_RESOURCES_DIR" "$BLOG_DIR/resources" # Generate static files with hugo echo "- Building site with Hugo v$HUGO_VERSION in $HUGO_DEST..." -hugo --source "$CLONE_DIR" --destination "$HUGO_DEST" --baseURL="https://${URL}" ${DRAFTS} --logLevel info --cleanDestinationDir --gc --panicOnWarning --printI18nWarnings +hugo --source "$BLOG_DIR" \ + --destination "$HUGO_DEST" \ + --baseURL="https://${URL}" \ + ${DRAFTS} \ + --logLevel info \ + --cleanDestinationDir \ + --gc \ + --panicOnWarning \ + --printI18nWarnings # Start nginx echo "- Starting Nginx..."