资源准备
域名一个:aiop.top
github账号一个
hexo环境准备
环境搭建
docker 安装 hexo,创建文件docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15version: '3'
services:
hexo:
image: node:16-alpine
container_name: hexo-blog
restart: unless-stopped
ports:
- "4000:4000"
working_dir: /usr/blog
volumes:
- "/Users/x/blog:/usr/blog"
- "./entrypoint.sh:/entrypoint.sh"
stdin_open: true
tty: true
entrypoint: entrypoint.sh创建文件entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
set -e
echo "切换中科大源"
sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
echo 安装bash git openssh 以及c的编译工具
apk add bash git openssh
echo 设置容器时区为上海
apk add tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
&& apk del tzdata
mkdir /usr/hexo
cd /usr/hexo
npm install hexo-cli -g
npm install hexo-server --save
cd /usr/blog
hexo init
#下面的不懂干嘛的
#if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ]; then
# set -- node "$@"
#fi
#exec "$@"然后:
1
2
3
4
5# 启动服务
docker-composer up -d
# 如果发生异常,可以手动进入到docker中操作,需要自己检测哪些没有执行自行执行
docker exec -it hexo-blog sh博客配置
假如我们已经进到docker内,在目录 /usr/blog 下有个 _config.yml ,打开它,我们来处理下主题:
theme: volantis
然后在当前的目录下:
npm i hexo-theme-volantis
等待都结束后:
hexo s
到这里你可以通过浏览器访问127.0.0.1:4000 看到自己的博客页面。
一些参考信息
https://volantis.vercel.app/v6/getting-started/ 所有主题的编辑看这里
https://hexo.io/zh-cn/docs/commands hexo使用的中文简介