docker/hexo/README.md
2018-07-21 15:53:33 +08:00

36 lines
1.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# hexo服务单独部署
## 创建镜像
```bash
docker build -t ccr.ccs.tencentyun.com/yy-dk/hexo:latest .
```
也可以直接下载镜像
```bash
docker pull ccr.ccs.tencentyun.com/yy-dk/hexo:latest
```
## 创建容器
```bash
docker run -d \
--privileged=true \
-p 8080:80 \
-e BRANCH=master \
-e REPOSITORY=http://gitlab+deploy-token-7:xrcYgvemJ3LXLJStSWG8@git.yangyufans.com/yangyufans/hexo-test.git \
--name hexo-test ccr.ccs.tencentyun.com/yy-dk/hexo:latest
```
- BRANCH 分支名称可在本地部署使用develop预览线上环境用master
- REPOSITORY 仓库地址
> http://<用户名>:< token >@<仓库地址>
## 自动部署
发布文章只需要将文章提交到对应的仓库docker 容器自动更新文章内容
## 插件安装
请在git仓库根目录创建install.sh,创建容器时自动安装
```bash
#!/bin/bash
npm install hexo-renderer-jade@0.3.0 --save
npm install hexo-renderer-stylus --save
npm install hexo-generator-feed --save
npm install hexo-generator-sitemap --save
npm install hexo-generator-baidu-sitemap --save
npm install hexo-generator-json-content@2.2.0 --save
```