Skip to content

Docker image for hugo static page generator with nodejs for dependency management and openssh to transfer file via scp/rsync (https://gohugo.io) (https://nodejs.org)

License

Notifications You must be signed in to change notification settings

lbenie/docker-nogo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lbenie/docker-nogo

Docker Build Statu Docker Automated buil Docker Pulls Docker Stars

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.

Prerequisites

The image is based on the following directory structure:

.
├── Dockerfile
├── docker-compose.yml
├── config.toml
├── content
│   └── ...
├── layouts
│   └── ...
└── static
    └── ...

Dockerfile

  FROM lucienb/docker-nogo:latest

Building your site

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 your site

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 ;)