Dockerfile for Hexo with Hexo Admin
The image is available directly from Docker Hub
A tutorial is available at spurin.com
Latest update locks the node version to 13-slim rather than slim (which at the time of writing is 14), whilst Hexo appears to work for most areas, there is at present an outstanding issue that prevents the hexo deploy
working with 14. See Hexo 4275
Create a new blog container, substitute domain.com for your domain and specify your blog location with -v target:/app, specify your git user and email address (for deployment):
docker create --name=hexo-domain.com \
-e HEXO_SERVER_PORT=4000 \
-e GIT_USER="Your Name" \
-e GIT_EMAIL="your.email@domain.tld" \
-v /blog/domain.com:/app \
-p 4000:4000 \
spurin/hexo
If a blog is not configured in /app (locally as /blog/domain.com) already, it will be created and Hexo-Admin will be installed into the blog as the container is started
docker start hexo-domain.com
Should you wish to perform further configuration, i.e. installing custom themes, this should be viable from the app specific volume, either directly or via the container (changes to the app volume are persistent). Accessing the container -
docker exec -it hexo-domain.com bash
Deployment keys are configured as part of the initial app configuration, see the .ssh directory within your app volume or, view the logs upon startup for the SSH public key
docker logs --follow hexo-domain.com
Each theme will vary but for example, a theme such as Hueman, clone the repository to the themes directory within the app volume
cd /app
git clone https://github.com/ppoffice/hexo-theme-hueman.git themes/hueman
Update _config.yml in your app folder, and change theme accordingly
theme: hueman
Enable the default configuration
mv themes/hueman/_config.yml.example themes/hueman/_config.yml
Exit the container
exit
And restart the container
docker restart hexo-domain.com
Access the default hexo blog interface at http://< ip_address >:4000
Access Hexo-Admin at http://< ip_address >:4000/admin
docker exec -it hexo-domain.com hexo generate
docker exec -it hexo-domain.com hexo deploy
If you wish to add specific hexo plugins, add them to a requirements.txt file to your app volume, for example (app/requirements.txt) -
hexo-generator-json-content
During startup, if the requirements.txt file exists, requirements are auto installed