lbenie/docker-nogo
is a Docker base image for static sites generated with Hugo.
Thanks to publysher for inspiring this image.
In contrary of his docker image, I've added nodejs to the image since I needed npm
to build my projects dependencies with bitbucket pipelines.
Also it contains openssh for transfering files with scp/rsync over my production server.
The build is relatively small at ~25MB.
The image is based on the following directory structure:
.
├── Dockerfile
├── docker-compose.yml
├── config.toml
├── content
│ └── ...
├── layouts
│ └── ...
└── static
└── ...
FROM lucienb/docker-nogo:latest
Based on this structure, you can easily build an image for your site:
docker build -t my/image .
Your site is automatically generated during this build.
Using this docker image together with nginx for serving static data.
docker-compose.yml
hugo:
image: lucienb/docker-nogo:latest
volumes:
- .:/src
- ./output/:/output
environment:
- HUGO_REFRESH_TIME=90 # rebuilds the project every 90 seconds
- HUGO_THEME=mytheme
- HUGO_BASEURL=//localhost/
restart: always
web:
image: jojomi/nginx-static
volumes:
- ./output:/var/www
environment:
- VIRTUAL_HOST=localhost/
ports:
- "1313:80"
restart: always
In your terminal run
docker-compose up
and Voilà !
You can access your web server at http://localhost:1313
served by nginx and updated every 90 seconds (HUGO_REFRESH_TIME=90)
Happy coding ;)