All checks were successful
Build Hugo Site / build (push) Successful in 10s
1.1 KiB
1.1 KiB
title, date, categories, tags
| title | date | categories | tags | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Docker Development Workflow for Hugo Themes | 2024-07-28 |
|
|
Docker Development Workflow for Hugo Themes
Setting up a consistent development environment across different machines is crucial for theme development. Here's my Docker-based workflow.
The Setup
FROM hugomods/hugo:exts-0.120.4
WORKDIR /src
COPY . /src/themes/nomad-tech/
CMD ["hugo", "server", "--bind", "0.0.0.0", "--buildDrafts"]
Docker Compose Configuration
services:
hugo:
build: .
volumes:
- "./exampleSite:/src"
ports:
- "1313:1313"
Benefits
- Consistency: Same Hugo version everywhere
- Security: Pinned, official images only
- Isolation: No local Hugo installation needed
- Portability: Works on any machine with Docker
Development Commands
# Start development server
docker-compose up
# Build for production
docker-compose run hugo hugo --minify
# Clean up
docker-compose down
This workflow has saved me countless hours of environment setup!