[Hexo] Use Docker or Docker Compose to run Hexo
col-hexo-docker
col-hexo is a Docker image to use Docker or Docker Compose to run Hexo.
Hexo is a fast, simple & powerful blog framework. It use plugins to provide features powerful APIs for limitless extensibility. Various plugins are available to support most template engines (EJS, Pug, Nunjucks, and many others). Easily integrate with existing NPM packages (Babel, PostCSS, Less/Sass, etc).
Prerequisites
-
Docker - https://www.docker.com/
Developing apps today requires so much more than writing code. Multiple languages, frameworks, architectures, and discontinuous interfaces between tools for each lifecycle stage creates enormous complexity.
Docker simplifies and accelerates your workflow, while giving developers the freedom to innovate with their choice of tools, application stacks, and deployment environments for each project.
To learn more about all the features of Docker, see Docker - https://www.docker.com/.
-
Docker Compose - https://docs.docker.com/compose/
Docker Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration.
To learn more about all the features of Docker Compose, see Docker Compose - https://docs.docker.com/compose/.
Usage
You can run it with Docker or Docker Compose.
You can replace the following with your preferred content.
Docker
First, edit or modify the ./Dockerfile.
1 |
|
Run with docker
command.
1 | docker build -t cloudolife/col-hexo . |
Docker Compose
Edit or modify ./docker-compose.yml.
1 | version: '3' |
Run with docker-compose
command.
1 | docker run --rm -it --name col-hexo col-hexo bash |
1 | docker-compose run --service-ports app bash |
Run Hexo
Then, run hexo init
to create a new site in the container.
1 | hexo init col-hexo-docker-example |
Run Hexo server.
1 | hexo s |
Now you can open http://localhost:4000 in your browser, and check whether the site works correctly.
References
[1] col-hexo-docker