Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install Hugo on Nanobox

Create a boxfile.yml

First create a boxfile using the content from this gist

Start the local env

nanobox run

Create a new site

cd /tmp
hugo new site NAME
cp -a NAME/* /app/
cd -

Start hugo

hugo server --bind "0.0.0.0"

Visit the app

In your browser, visit the IP or domain if added at port 1313

Develop

Write the app!

run.config:
# use the static engine
engine: static
# install hugo
extra_steps:
- bash <(curl -s -L https://tinyurl.com/y8yojxte)
#!/bin/bash
if [[ ! -f /data/bin/hugo ]]; then
cd /tmp
wget https://github.com/gohugoio/hugo/releases/download/v0.25.1/hugo_0.25.1_Linux-64bit.tar.gz
tar -xzf hugo_0.25.1_Linux-64bit.tar.gz
mv hugo /data/bin/hugo
cd -
rm -rf /tmp/*
fi
@tylerflint
Copy link
Author

tylerflint commented Jul 18, 2017

Don't worry about the install.sh script. The tinyurl included in the extra_steps will pull the content and install hugo.

@Tolmark12
Copy link

Tolmark12 commented Jul 18, 2017

You'll want to add the baseUrl flag when running the server locally:

# If you specify a custom local dns alias:
hugo server --baseUrl=mysite.dev --bind="0.0.0.0"

# If no custom dns alias, use the IP address provided by nanobox
hugo server --baseUrl=172.19.0.4 --bind="0.0.0.0"

NOTE, I haven't figured out how to get livereload to work yet, but this is the start:

run.config:
  # use the static engine
  engine: static
  # enable file watching for live reload
  fs_watch: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment