Docker image with hugo inside
Docker 17.05 or higher
docker-compose 1.6.2 or higher
Alpine image v.3.6
hugo 0.55.6
If I want to create a new hugo structure in my current path:
~ docker run -it --rm --user $(id -u):$(id -g) -v $(pwd)/:/usr/local/share/src -w /usr/local/share/src andru255/hugocker hugo new site my-site-test
I need to locate my new site like a volume, but don't change the src folder from the container
~ cd my-site-test
~ docker run -it --rm --user $(id -u):$(id -g) -v $(pwd)/:/usr/local/share/src -w /usr/local/share/src andru255/hugocker hugo new post/my-post-demo.md
If do you want to install a new theme, it's no depends for hugocker, but a little example: If I want to install the hyde theme
~ cd my-site-test/themes
~ git clone https://github.com/spf13/hyde
We have what it takes to have a visible blog (structure, a post, a theme), and we want to getting visible on a browser:
~ cd my-site-test
~ docker run --publish 1313:1313 --rm --user $(id -u):$(id -g) -v $(pwd)/:/usr/local/share/src -w /usr/local/share/src andru255/hugocker hugo server -D -t hyde --bind=0.0.0.0
That command creates a folder with name public which contains the static files to publish
~ cd my-site-test
~ docker run --publish 1313:1313 --rm --user $(id -u):$(id -g) -v $(pwd)/:/usr/local/share/src -w /usr/local/share/src andru255/hugocker hugo -D -v -t hyde
The docker-compose.yml* file:
version: "2"
services:
hugocker:
image: andru255/hugocker
ports:
- "1313:1313"
working_dir: "/usr/local/share/src"
volumes:
- $PWD:/usr/local/share/src
If I want to create a new hugo structure in my current path:
~ docker-compose run --rm --user $(id -u):$(id -g) hugocker hugo new site my-site-test
I need to locate my new site like a volume, but don't change the src folder from the container
~ cd my-site-test
~ docker-compose run --rm --user $(id -u):$(id -g) hugocker hugo new post/my-post-demo.md
The same process because only needs git:
~ cd my-site-test/themes
~ git clone https://github.com/spf13/hyde
We have what it takes to have a visible blog (structure, a post, a theme), and we want to getting visible on a browser:
~ cd my-site-test
~ docker-compose run --publish 1313:1313 --rm --user $(id -u):$(id -g) hugocker hugo server -D -t hyde --bind=0.0.0.0
~ cd my-site-test
~ docker-compose run --rm --user $(id -u):$(id -g) hugocker hugo -D -v -t hyde
Content type
Image
Digest
Size
19.4 MB
Last updated
about 7 years ago
docker pull andru255/hugocker