Coder Social home page Coder Social logo

v1k0d3n / docker-hugo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jojomi/docker-hugo

0.0 3.0 0.0 9.39 MB

Docker image for hugo static page generator (https://gohugo.io)

Home Page: https://hub.docker.com/r/jojomi/hugo

License: MIT License

Dockerfile 8.69% Shell 16.64% CSS 36.03% HTML 38.64%

docker-hugo's Introduction

docker-hugo

Docker image for hugo static page generator (https://gohugo.io)

Environment Variables

  • HUGO_THEME
  • HUGO_WATCH (set to any value to enable watching)
  • HUGO_DESTINATION (Path where hugo will render the site. By default /output)
  • HUGO_REFRESH_TIME (in seconds, only applies if not watching, if not set, the container will build once and exit)
  • HUGO_BASEURL

Executing

docker run --name "my-hugo" -P -v $(pwd):/src jojomi/hugo

Or, more verbosely, and with a specified output mapping:

docker run --name "my-hugo" --publish-all \
       --volume $(pwd):/src \
       --volume /tmp/hugo-build-output:/output \
       jojomi/hugo

Find your container:

docker ps | grep "my-hugo"
CONTAINER ID        IMAGE                           COMMAND                CREATED             STATUS              PORTS                   NAMES
ba00b5c238fc        jojomi/hugo:latest   "/run.sh"              7 seconds ago       Up 6 seconds        1313/tcp      my-hugo

Building The Image Yourself (optional)

docker build -t jojomi/hugo:latest .

The image is conveniently small at about 20 MB thanks to alpine:

docker images | grep hugo
jojomi/hugo:0.18   latest              b2e7a8364baa        1 second ago      21.9 MB

Creating a new tag

Create a new git branch, change the line ENV HUGO_VERSION=0.18 in Dockerfile and wire it in the Docker Hub accordingly.

docker-compose

Using this docker image together with nginx for serving static data.

docker-compose.yml

hugo:
  image: jojomi/hugo:latest
  volumes:
    - ./src/:/src
    - ./output/:/output
  environment:
    - HUGO_REFRESH_TIME=3600
    - HUGO_THEME=mytheme
    - HUGO_BASEURL=mydomain.com
  restart: always

web:
  image: jojomi/nginx-static
  volumes:
    - ./output:/var/www
  environment:
    - VIRTUAL_HOST=mydomain.com
  ports:
    - 80
  restart: always

VIRTUAL_HOST is set for use with jwilder's nginx-proxy:

docker-compose.yml

proxy:
  image: jwilder/nginx-proxy
  ports:
    - 80:80
    - 443:443
  volumes:
    - /var/run/docker.sock:/tmp/docker.sock
    - vhost.d:/etc/nginx/vhost.d:ro
  restart: always

Update Image on Hugo Update

./update.sh 0.25

docker-hugo's People

Contributors

jojomi avatar renovate-bot avatar olleolleolle avatar hutson avatar lordoffreaks avatar cjkinni avatar r3kzi avatar nicemd avatar kontotto avatar renovate[bot] avatar

Watchers

James Cloos avatar Brandon B. Jozsa avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.