Skip to content

Commit

Permalink
Improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ntrrg committed Nov 8, 2019
1 parent b59299e commit 26413c6
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 31 deletions.
37 changes: 20 additions & 17 deletions .ntweb/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ description: Dockerized Hugo CLI.
metadata:
source-code: https://github.com/ntrrg/docker-hugo
license: MIT
kinds:
tags:
- cli
- container
techs:
- containers
- docker
- hugo
---
Expand All @@ -30,7 +29,7 @@ techs:
# Usage

```shell-session
$ docker run --rm -v /path/to/my/site:/site \
$ docker run --rm -v /path/to/my/site/:/site/ \
ntrrg/hugo [OPTIONS] [COMMAND]
```

Expand All @@ -42,44 +41,48 @@ Since the Hugo binary from the container is called by `root`, it is
recommendable to add the `-u` Docker flag.

```shell-session
$ docker run --rm -v /path/to/my/site:/site \
$ docker run --rm -v /path/to/my/site/:/site/ \
-u $(id -u $USER) \
-v ${TMPDIR:-/tmp/}:/tmp/ \
ntrrg/hugo [OPTIONS] [COMMAND]
```
{{% /note %}}

## Examples

* Create new Hugo skeleton
* Create a new Hugo skeleton

```shell-session
$ docker run --rm -v /path/to/my/site:/site ntrrg/hugo new site .
$ docker run --rm -v /path/to/my/site/:/site/ \
ntrrg/hugo new site .
```

* Build Hugo project
* Build a Hugo project

```shell-session
$ docker run --rm -v /path/to/my/site:/site ntrrg/hugo
$ docker run --rm -v /path/to/my/site/:/site/ ntrrg/hugo
```

* Run Hugo server
* Run the Hugo server

```shell-session
$ docker run --rm -itp 1313:1313 -v /path/to/my/site:/site \
ntrrg/hugo server -DEF --bind=0.0.0.0 \
--baseUrl=/ --appendPort=false
$ docker run --rm -i -t -p 1313:1313 \
-v /path/to/my/site/:/site/ \
ntrrg/hugo server -DEF --baseUrl=/ \
--bind=0.0.0.0 --appendPort=false
```

* Run Hugo server with custom port
* Run the Hugo server with a custom port

```shell-session
$ export PORT=8080
```

```shell-session
$ docker run --rm -itp $PORT:$PORT -v /path/to/my/site:/site \
ntrrg/hugo server -DEF --bind=0.0.0.0 --port=$PORT \
--baseUrl=/ --appendPort=false
$ docker run --rm -i -t -p $PORT:$PORT \
-v /path/to/my/site/:/site/ \
ntrrg/hugo server -DEF --bind=0.0.0.0 --port=$PORT \
--baseUrl=/ --appendPort=false
```

# Acknowledgment
Expand Down
31 changes: 17 additions & 14 deletions .ntweb/index.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ description: CLI de Hugo en Docker.
metadata:
source-code: https://github.com/ntrrg/docker-hugo
license: MIT
kinds:
tags:
- cli
- contenedores
techs:
- docker
- hugo
---
Expand All @@ -30,20 +29,21 @@ techs:
# Uso

```shell-session
$ docker run --rm -v /path/to/my/site:/site -u "$(id -u "$USER")" \
$ docker run --rm -v /ruta/a/mi/sitio/:/site/ \
ntrrg/hugo [OPCIONES] [COMANDO]
```

Puede usarse cualquier comando del CLI de Docker, para más información ejecutar
`docker run --rm ntrrg/hugo help` o ver la [documentación oficial](https://gohugo.io/commands/).
Puede usarse cualquier comando del CLI de Hugo, para más información ejecutar `docker run --rm ntrrg/hugo help`
o ver la [documentación oficial](https://gohugo.io/commands/).

{{% note %}}
Como el binario de Hugo del contenedor es ejecutado por `root`, es recomendable
agregar la opción `-u` de Docker.

```shell-session
$ docker run --rm -v /path/to/my/site:/site \
$ docker run --rm -v /ruta/a/mi/sitio/:/site/ \
-u $(id -u $USER) \
-v ${TMPDIR:-/tmp/}:/tmp/ \
ntrrg/hugo [OPCIONES] [COMANDO]
```
{{% /note %}}
Expand All @@ -53,21 +53,23 @@ $ docker run --rm -v /path/to/my/site:/site \
* Crear el esqueleto de un projecto Hugo

```shell-session
$ docker run --rm -v /path/to/my/site:/site ntrrg/hugo new site .
$ docker run --rm -v /ruta/a/mi/sitio/:/site/ \
ntrrg/hugo new site .
```

* Construir un proyecto Hugo

```shell-session
$ docker run --rm -v /path/to/my/site:/site ntrrg/hugo
$ docker run --rm -v /ruta/a/mi/sitio/:/site/ ntrrg/hugo
```

* Ejecutar el servidor de Hugo

```shell-session
$ docker run --rm -itp 1313:1313 -v /path/to/my/site:/site \
ntrrg/hugo server -DEF --bind=0.0.0.0 \
--baseUrl=/ --appendPort=false
$ docker run --rm -i -t -p 1313:1313 \
-v /ruta/a/mi/sitio/:/site/ \
ntrrg/hugo server -DEF --bind=0.0.0.0 \
--baseUrl=/ --appendPort=false
```

* Ejecutar el servidor de Hugo en un puerto personalizado
Expand All @@ -77,9 +79,10 @@ $ export PORT=8080
```

```shell-session
$ docker run --rm -itp $PORT:$PORT -v /path/to/my/site:/site \
ntrrg/hugo server -DEF --bind=0.0.0.0 --port=$PORT \
--baseUrl=/ --appendPort=false
$ docker run --rm -i -t -p $PORT:$PORT \
-v /path/to/my/site:/site \
ntrrg/hugo server -DEF --bind=0.0.0.0 --port=$PORT \
--baseUrl=/ --appendPort=false
```

# Atribuciones
Expand Down
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
hugo_port := 1313

.PHONY: all
all:

.PHONY: docs
docs:
@echo "http://localhost:$(hugo_port)/en/projects/docker-hugo/"
@echo "http://localhost:$(hugo_port)/es/projects/docker-hugo/"
@docker run --rm -it \
-e PORT=$(hugo_port) \
-p $(hugo_port):$(hugo_port) \
-v "$$PWD/.ntweb":/site/content/projects/docker-hugo/ \
ntrrg/ntweb:editing --port $(hugo_port)

0 comments on commit 26413c6

Please sign in to comment.