Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fletchto99/hexo-dev-docker
A docker for hexo blog development
https://github.com/fletchto99/hexo-dev-docker
Last synced: 2 months ago
JSON representation
A docker for hexo blog development
- Host: GitHub
- URL: https://github.com/fletchto99/hexo-dev-docker
- Owner: fletchto99
- License: mit
- Created: 2018-10-25T04:13:15.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-11-22T08:45:46.000Z (about 2 years ago)
- Last Synced: 2023-04-04T15:18:40.067Z (almost 2 years ago)
- Language: Shell
- Size: 531 KB
- Stars: 7
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Hexo Dev Blog
This container enables the static blogging platform hexo to be containerized. It allows for custom themes, plugins and configurations. A sample of this running can be seen at [https://blog-test.fletchto99.com](https://blog-test.fletchto99.com). This container is mainly intended for development use and rapid prototyping of blog posts, however it should be possible to run this in a production setting as well. The recommended route would be to setup a deployment and use `hexo deploy` via the docker console to send the static files to be served by a CDN or something similar.
## Usage
```
docker create \
--name=blog \
-v :/config \
-e PGID= -e PUID= \
-e HEXO_PLUGINS= \
-p 8080:8080 \
fletchto99/hexo-dev-blog
```## Parameters
* `-p 8080` - The port to run the container on
* `-v /config` - Configuration files and generated blog files_Optional paramaters:_
* `-e HEXO_PLUGINS` - Any [hexo plugins](https://hexo.io/plugins/index.html) you wish the blog to have access to, space seperated. For example `hexo-sliding-spoiler hexo-wordcount hexo-deploy-rsync`## Setting up the config directory
The first time the container is started up, if the mounted config volume is empty the default contents will be automatically generated. In specific:
* `config/_config.yml` - The hexo config file
* `config/_posts` - The directory to save your markdown posts
* `config/themes/` - Same as the themes directory when generating a hexo blog
* `config/public` - The directory in which the static HTML files will be saved and served from (feel free to copy these to your production server to deploy)## Advanced usage
Below we explore some more advanced use cases such as deploying via `hexo deploy` or using custom themes which require some setup.
### Custom themes
Some themes require setup which involves running commands like `npm install`. To do so follow these steps:
1. Clone the theme into the `config/themes/` directory.
2. Attach to the docker's console and navigate to `/blog/themes/`
3. Run the required commands within the container to generate any required filesThat should allow you to use the theme now! Be sure to setup any configurations within the theme as well
### Deploying
Currently this container supports blog deployment via rsync through the `hexo-deploy-rsync` plugin. Here's an example of the deploy section of a config. Note that the `deploy_key` is a private RSA key which will be used to deploy to the production server. It is saved at `config/deploy_key` which is then shared with the container through the mounted volume.
```yaml
deploy:
type: rsync
host:
user:
root:
port: 22
delete: true
args: "-e ssh -i /config/deploy_key @"
verbose: true
ignore_errors: false
```Now to deploy all I need to do is attach to the console and run `hexo deploy`