Hexo.io static site generator demo with Docker. Read my blog Troubleshooting Docker for more details.
Clone the repository
git clone git@github.com:Pen-y-Fan/hexo-demo.git
cd hexo-demo
echo $(id -u)
# check your user id is 1000, if different edit Makefile and change UID=1000
make shell-run
# inside the Docker container /app install the dependencies
yarn
The server can be started on port 4000
# with Make and Docker
make server
Once started open the browser localhost:4000
More info: Server
make server
Will start the container equivalent to:
docker run -d -p 4000:4000 -u $(id -u):$(id -g) -v $(pwd):/app -w /app --rm node:12.18.4-alpine yarn server
-d
starts the docker container in a demon (background)-p 4000:4000
on port 4000 and expose port 4000-u $(id -u):$(id -g)
under the current user's account-v $(pwd):/app
map the current directory to /app in the container-w /app
make /app the working directory--rm
when the container is closed it will be removednode:12.18.4-alpine
the node 12 LTS release using the lightweight Alpine OSyarn server
runs the package.json scripthexo server
Note: Node 14 LTS has a Regression in Node 14, therefore the composer-compose.yml has been configured to use Node 12 until this is resolved.
Options, depending on node being installed, with or without but hexo, or docker can be used, via make command.
# or with Make and Docker:
make hexo new=My-New-Post
Note: The title
will need to be manually updated in the My-New-Post.md file
More info: Writing
Options, depending on node being installed, with or without but hexo, or docker can be used, via make command
# with Make/Docker
make generate
More info: Generating
See github pages on how to deploy a project.
Once finished run
make down
This will run docker-compose down --remove-orphans