aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-12-02 14:02:11 +0800
committercrupest <crupest@outlook.com>2022-12-02 14:02:11 +0800
commit56f8a5faa3a89721754c2e9861c2ff8cea999f8e (patch)
tree77acf5f9b4364ab407400244711b9bf09b4d8713
parente48986d206bef7a5177645ac19e1a996f9874a3c (diff)
downloadcrupest-56f8a5faa3a89721754c2e9861c2ff8cea999f8e.tar.gz
crupest-56f8a5faa3a89721754c2e9861c2ff8cea999f8e.tar.bz2
crupest-56f8a5faa3a89721754c2e9861c2ff8cea999f8e.zip
Try to fix hugo. v2
-rw-r--r--docker/crupest-blog/Dockerfile9
-rwxr-xr-xdocker/crupest-blog/install-hugo.bash10
2 files changed, 7 insertions, 12 deletions
diff --git a/docker/crupest-blog/Dockerfile b/docker/crupest-blog/Dockerfile
index a7d00cb..43bd5b4 100644
--- a/docker/crupest-blog/Dockerfile
+++ b/docker/crupest-blog/Dockerfile
@@ -1,8 +1,13 @@
+FROM golang:alpine AS builder
+RUN go install -tags extended github.com/gohugoio/hugo@latest && /root/go/hugo version
+
FROM alpine:latest
ARG CRUPEST_BLOG_UPDATE_INTERVAL=1d
ENV CRUPEST_BLOG_UPDATE_INTERVAL=${CRUPEST_BLOG_UPDATE_INTERVAL}
-COPY install-hugo.bash daemon.bash update.bash /scripts/
-RUN apk add --no-cache coreutils gzip tar tini curl bash git && /scripts/install-hugo.bash
+COPY --from=builder /root/go/hugo /usr/bin
+RUN hugo version
+COPY daemon.bash update.bash /scripts/
+RUN apk add --no-cache coreutils tini bash git
VOLUME [ "/public" ]
ENTRYPOINT ["/sbin/tini", "--"]
CMD [ "/daemon.bash" ]
diff --git a/docker/crupest-blog/install-hugo.bash b/docker/crupest-blog/install-hugo.bash
deleted file mode 100755
index ff83b3c..0000000
--- a/docker/crupest-blog/install-hugo.bash
+++ /dev/null
@@ -1,10 +0,0 @@
-#! /usr/bin/env bash
-
-set -e
-
-VERSION=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
-url="https://github.com/gohugoio/hugo/releases/download/v${VERSION}/hugo_extended_${VERSION}_linux-amd64.tar.gz"
-curl -fL -o /root/hugo.tar.gz "${url}"
-tar -xzf /root/hugo.tar.gz -C /usr/bin hugo
-
-hugo version