A comprehensive guide to setting up HBStack with Docker. This guide covers framework understanding, command execution patterns, and development workflow setup.
A comprehensive guide to setting up HBStack with Docker. This guide covers framework understanding, command execution patterns, and development workflow setup.
HBStack is a modular Hugo theme framework built on top of Hugo’s module system, Bootstrap, and other modern web technologies.
When working with HBStack, commands can be managed differently depending on whether you’re using Docker or not.
In a traditional setup without Docker, HBStack commands are defined in package.json:
1{
2 "scripts": {
3 "dev": "hugo server --gc --enableGitInfo -D",
4 "prod": "hugo server --gc --disableFastRender --enableGitInfo --renderToDisk --minify -e production -p 1314"
5 }
6}
These commands are executed using npm:
1npm run dev # Start development server
2npm run prod # Start production server
When using Docker with HBStack, commands are managed differently:
Commands in docker-compose.yml
The primary command is defined in the docker-compose.yml file:
1services:
2 server:
3 image: hugomods/hugo:exts-non-root
4 command: server -D
5 # ...other configuration...
Running commands
Start the server with:
1docker-compose up
Run a one-time command:
1docker-compose run --rm server hugo [command]
Creating custom commands
For more complex operations, you can create additional services in your docker-compose.yml:
1services:
2 server:
3 # Development server
4
5 production:
6 image: hugomods/hugo:exts-non-root
7 command: server --gc --minify -e production
8 ports:
9 - 1314:1314
10 volumes:
11 - ./:/src
Then run with:
1docker-compose up production
Using Docker simplifies dependency management and ensures consistent environments across different development setups.