Skip to content

raffaeldutra/docker-gohugo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gohugo Docker Image

! ! ! ! !

You can find this image in the link below.

https://hub.docker.com/r/raffaeldutra/docker-gohugo

Content for your project

The simplest way is the better way, right? I hope so.

For those who will use Linux:

  • You can share the "current" directory $(pwd) to /src folder inside of Docker container. This folder is used for Hugo.
  • To publish your project, you can use the "public" directory, or whatever you want, but you need to pass the /src/public directory, that's what Hugo expects, at least for now.

IMPORTANT: Image tags are the same as GoHugo releaes.

Building an image

docker build -t raffaeldutra/docker-gohugo:<VERSION> .

How to create a project

Run the command below, but pay attention because it will create a new directory called "my-new-website". Change this for what you want.

docker run --rm -d \
-v $(pwd):/my-new-project \
raffaeldutra/docker-gohugo:<VERSION> \
/usr/local/bin/hugo new site /my-new-project/my-new-website

Once created, go to this new directory "my-new-website" and download your template as usual.

How to publish your website

Code publishment, convert all md files to HTML.

docker run -it \
-v $(pwd):/src \
-v $(pwd)/public:/src/public raffaeldutra/docker-gohugo:<VERSION>

How to run a server

Here is the how you can do it.

docker run -it \
-v $(pwd):/src \
-p 1313:1313 raffaeldutra/docker-gohugo /gohugo.sh -s

How to run a server in a different URL

docker run -it \
-v $(pwd):/src \
-e BASEURL=192.168.10.10 \
-p 1313:1313 raffaeldutra/docker-gohugo:<VERSION> /gohugo.sh -s