搭建Hexo个人博客记录

  • Dockerfile
FROM node:15.7.0-alpine3.10
WORKDIR /usr/blog

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
RUN apk add bash git openssh
RUN apk add tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
&& apk del tzdata

RUN \
npm config set registry https://registry.npm.taobao.org \
&&npm install \
&&npm install hexo-cli -g \
&& npm install hexo-server --save \
&& npm install hexo-asset-image --save \
&& npm install hexo-wordcount --save \
&& npm install hexo-generator-sitemap --save \
&& npm install hexo-generator-baidu-sitemap --save \
&& npm install hexo-deployer-git --save \
&& npm install hexo-admin --save

EXPOSE 4000
# 制作镜像
docker build .
docker images
docker tag 【镜像id】 hexo
mkdir ~/hexo
# 运行容器
docker run -d -it -p 4000:4000 -v ~/hexo:/usr/blog/ hexo /bin/bash
# Site
title: Link2Points
subtitle: ''
description: "Link2Points' Blog"
keywords: Tech, Study
author: Link2Points
language: zh-Hans
timezone: 'Asia/Shanghai'


# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
#theme: landscape
theme: next

#
  • 后台启动
docker ps
docker exec -it 【容器id】 /bin/bash -c "hexo g"
docker exec -it 【容器id】 /bin/bash -c "hexo s -d &"
# 回车
  • 访问ip:4000/admin,设置密码
  • 将生成的加密结果添加到~/hexo/_config.yml文件中
  • 由此添加标题撰写博客(Markdown)
    在这里插入图片描述
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值