Skip to content

Conversation

@Pahari47
Copy link

What does it do?

Adds Docker containerization support for Hexo’s core repository to simplify local development, testing, and CI consistency.

Currently, Hexo requires manual Node.js setup (>=20.19.0). This PR introduces a standardized Docker environment allowing contributors to build, serve, and test Hexo inside an isolated container — reducing setup friction and ensuring consistent builds across systems.


Solution

Introduced a minimal Dockerfile (based on Node 20 Alpine) and an optional docker-compose.yml for quick startup.
The image installs dependencies, builds the project, and can run either the development server or test suite.

Key Highlights:

  • Uses official node:20-alpine base (aligns with Hexo 8+ requirements)
  • Installs dependencies and builds Hexo inside container
  • Exposes port 4000 for hexo server
  • Optional volume mapping for live development with Docker Compose

Changes Made

  • Dockerfile: Added Node 20 Alpine image for reproducible environment
  • docker-compose.yml: Added for quick setup and local testing

Pull request tasks

  • Add Dockerfile
  • Add docker-compose.yml
  • Update documentation
  • Test container build and hexo server functionality
  • Passed the CI test

Testing

✅ Verified that Hexo builds and serves locally using Docker
hexo generate and hexo server run successfully inside container
✅ Compatible with Node.js 20 and Alpine environment
✅ No impact on existing development workflow


Example Usage

# Build Docker image
docker build -t hexo-dev .

# Serve site inside container
docker run -p 4000:4000 hexo-dev

# Or use Docker Compose for convenience
docker-compose up

@github-actions
Copy link

How to test

git clone -b new-feature https://github.com/Pahari47/hexo.git
cd hexo
npm install
npm test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant