构建hexo和simiki工具的docker镜像


基于hexosimiki工具构建基础镜像环境,用作我website项目中website-on-gitlab CI/CD的基础镜像。并将其发布到Docker Hub的
PUBLIC REPOSITORY

DockerFile

通过官方centos7镜像为基础来构建包含构建website的构建环境。具体的环境包括:hexo, python3.6, nodejs, simiki, pip3.6

FROM centos
#安装EPEL依赖 Python3.6 pip3 nodejs npm hexo simiki
RUN yum install -y epel-release; yum install -y https://centos7.iuscommunity.org/ius-release.rpm; yum install -y python36u; yum install -y python36u-pip; pip3.6 install --upgrade pip; curl -sL https://rpm.nodesource.com/setup_8.x | bash -; yum install -y nodejs; npm install hexo-cli -g; pip3.6 install simiki

Docker Build

docker build -t longsl/hexo2simiki .

Docker Container

docker run -it --rm longsl/hexo2simki /bin/sh

Supply

关于下载最新版本的nodejs费了笔者一些功夫,因为通过yum install -y nodejs直接下载的包不是最新的版本,在hexo构建时,会提示npm版本过低的报错,因此我通过参考 How to install Node.js on CentOS 7,更新yum源来下载node 8.x的版本。

curl -sL https://rpm.nodesource.com/setup_8.x | sudo bash -
sudo yum install nodejs
隐藏边栏