Skip to content

Commit

Permalink
add second example: hugo in a container
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
  • Loading branch information
TomasTomecek committed Mar 18, 2019
1 parent f8ffe52 commit 67d5665
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
25 changes: 24 additions & 1 deletion README.md
Expand Up @@ -53,5 +53,28 @@ $ make test

Let's containerize static site generator - [Hugo](https://gohugo.io/).

TBD
The complete solution is available as [hugo.yaml](/hugo.yaml).

If we wanted to run this container in rootless podman, we would need to have
podman 1.1+ because port forwarding for rootless is available since this
version.

Let's run it in docker then! We need to push the image to dockerd first:
```
$ ansible-bender push docker-daemon:hugo:latest
```

Let's make sure that the metadata are correct:
```
$ docker inspect hugo
```

We can run hugo now:
```
$ docker run -p 80:80 hugo
```

...and use sen to check it out:
```
$ sen
```
27 changes: 27 additions & 0 deletions hugo.yaml
@@ -0,0 +1,27 @@
---
- name: Obtain hugo
hosts: all
vars:
site_path: /src
ansible_bender:
base_image: "fedora:29"
target_image:
name: hugo
working_dir: /src
cmd: "hugo server -wD --bind 0.0.0.0 --port 80"
tasks:
- name: Install hugo package
package:
name:
- hugo
- git-core
- name: Initiate new hugo site at {{ site_path }}
command: hugo new site {{ site_path }}
- name: Add a hugo theme
git:
repo: https://github.com/budparr/gohugo-theme-ananke.git
dest: '{{ site_path }}/themes/ananke'
- name: Use the theme
lineinfile:
line: 'theme = "ananke"'
path: '{{ site_path }}/config.toml'

0 comments on commit 67d5665

Please sign in to comment.