aboutsummaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-12-03 10:51:41 +0800
committercrupest <crupest@outlook.com>2022-12-03 10:55:53 +0800
commit8be4a344689d6ee5f62abc8ffc7f9d8f153daf0e (patch)
tree9e2799000b20867993cdd6fc48e65f417a4e14dc /docker
parent2f0bb3d1c402260119f90415bc5c454213ef3cdb (diff)
downloadcrupest-8be4a344689d6ee5f62abc8ffc7f9d8f153daf0e.tar.gz
crupest-8be4a344689d6ee5f62abc8ffc7f9d8f153daf0e.tar.bz2
crupest-8be4a344689d6ee5f62abc8ffc7f9d8f153daf0e.zip
Fix hugo image too big issue.
Diffstat (limited to 'docker')
-rwxr-xr-xdocker/code-server/install-code-server.bash10
-rw-r--r--docker/crupest-blog/Dockerfile6
-rwxr-xr-xdocker/crupest-blog/install-hugo.bash22
3 files changed, 34 insertions, 4 deletions
diff --git a/docker/code-server/install-code-server.bash b/docker/code-server/install-code-server.bash
index 7981f88..57eea80 100755
--- a/docker/code-server/install-code-server.bash
+++ b/docker/code-server/install-code-server.bash
@@ -9,6 +9,14 @@ localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
VERSION=$(curl -s https://api.github.com/repos/coder/code-server/releases/latest | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
-curl -fOL "https://github.com/coder/code-server/releases/download/v${VERSION}/code-server_${VERSION}_amd64.deb"
+echo "The latest version of code-server is ${VERSION}."
+
+url="https://github.com/coder/code-server/releases/download/v${VERSION}/code-server_${VERSION}_amd64.deb"
+
+echo "Download code-server from $url."
+
+curl -sSfOL "$url"
dpkg -i "code-server_${VERSION}_amd64.deb"
rm "code-server_${VERSION}_amd64.deb"
+
+echo "Code-server version: $(code-server --version)."
diff --git a/docker/crupest-blog/Dockerfile b/docker/crupest-blog/Dockerfile
index f9abc8b..d1ff761 100644
--- a/docker/crupest-blog/Dockerfile
+++ b/docker/crupest-blog/Dockerfile
@@ -1,7 +1,7 @@
-FROM golang:alpine AS build-hugo
+FROM debian:latest
ARG CRUPEST_BLOG_UPDATE_INTERVAL=1d
-RUN apk add --no-cache build-base coreutils tini bash git
-RUN CGO_ENABLED=1 go install --tags extended github.com/gohugoio/hugo@latest && hugo version
+COPY install-hugo.bash /install-hugo.bash
+RUN /install-hugo.bash && rm /install-hugo.bash
ENV CRUPEST_BLOG_UPDATE_INTERVAL=${CRUPEST_BLOG_UPDATE_INTERVAL}
COPY daemon.bash update.bash /scripts/
VOLUME [ "/public" ]
diff --git a/docker/crupest-blog/install-hugo.bash b/docker/crupest-blog/install-hugo.bash
new file mode 100755
index 0000000..e57bfd6
--- /dev/null
+++ b/docker/crupest-blog/install-hugo.bash
@@ -0,0 +1,22 @@
+#! /usr/bin/env bash
+
+set -e
+
+apt-get update
+apt-get install -y tini locales curl
+rm -rf /var/lib/apt/lists/*
+localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
+
+VERSION=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
+
+echo "The latest version of hugo is $VERSION."
+
+url="https://github.com/gohugoio/hugo/releases/download/v${VERSION}/hugo_${VERSION}_linux-amd64.deb"
+
+echo "Download hugo from $url."
+
+curl -sSfOL "$url"
+dpkg -i "hugo_${VERSION}_linux-amd64.deb"
+rm "hugo_${VERSION}_linux-amd64.deb"
+
+echo "Hugo version: $(hugo version)."