Skip to content

Commit

Permalink
docs: add doc about Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
chevdor committed Sep 7, 2021
1 parent 240a73a commit f0997b7
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 16 deletions.
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,31 @@ The **tera** engine allows way more than the simple replacements shown above. Yo

## Execute as Docker container

You can find a `tera` Docker image at `chevdor/tera`. The image is very small and should be less than 8MB.

You can test it with:

docker run --rm -it chevdor/tera --version

The Docker image mentioned above is not yet built by the CI so you may not find the very latest version from time to time.

### Build container image

docker build --tag 'tera-cli' .
docker build --tag tera-cli .

### Execute `tera` from the Docker container

Check tera help
**Check the tera help**

docker run -it --rm tera-cli --help

Parse a template
**Parse a template**

docker run -it --rm \
--volume="$(pwd):/opt" \
--volume="$(pwd)/templates:/templates" \
--read-only \
--env=FOO=BAR \
tera-cli --template templates/env-debug.txt --env-only --env-key env
tera-cli --template /templates/env-debug.txt --env-only --env-key env

## What can I do with that anyway ?

Expand Down Expand Up @@ -148,11 +157,13 @@ While the syntax is a little more verbose, paired with `--fail-on-collision`, th

Using the `--include` flag, the command will scan recursively for files that could be [included](https://tera.netlify.app/docs/#include), used as [macros](https://tera.netlify.app/docs/#macros) or for [inheritance](https://tera.netlify.app/docs/#inheritance). By default, it will scan the folder where the main template is located, unless the `--include-path` option is given.

From this repository, you can test **include** feature with the command `USER="[YOURNAME]" tera --template data/include/hello.txt --include --env-only` and test **inheritance** feature with `USER="[YOURNAME]" tera --template data/inheritance/child.txt --inherit --env-only`.
From this repository, you can test the **include** feature with the command:

USER="[YOURNAME]" tera --template data/include/hello.txt --include --env-only

### Output
and test the **inheritance** feature with:

By default,
USER="[YOURNAME]" tera --template data/inheritance/child.txt --inherit --env-only

### Content escaping

Expand Down
27 changes: 19 additions & 8 deletions README_src.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,31 @@ The **tera** engine allows way more than the simple replacements shown above. Yo

== Execute as Docker container

You can find a `tera` Docker image at `chevdor/tera`. The image is very small and should be less than 8MB.

You can test it with:

docker run --rm -it chevdor/tera --version

WARNING: The Docker image mentioned above is not yet built by the CI so you may not find the very latest version from time to time.

=== Build container image

docker build --tag 'tera-cli' .
docker build --tag tera-cli .

=== Execute `tera` from the Docker container

Check tera help
.Check the tera help

docker run -it --rm tera-cli --help

Parse a template
.Parse a template

docker run -it --rm \
--volume="$(pwd):/opt" \
--volume="$(pwd)/templates:/templates" \
--read-only \
--env=FOO=BAR \
tera-cli --template templates/env-debug.txt --env-only --env-key env
tera-cli --template /templates/env-debug.txt --env-only --env-key env

== What can I do with that anyway ?

Expand Down Expand Up @@ -122,11 +131,13 @@ While the syntax is a little more verbose, paired with `--fail-on-collision`, th

Using the `--include` flag, the command will scan recursively for files that could be https://tera.netlify.app/docs/#include[included], used as https://tera.netlify.app/docs/#macros[macros] or for https://tera.netlify.app/docs/#inheritance[inheritance]. By default, it will scan the folder where the main template is located, unless the `--include-path` option is given.

From this repository, you can test *include* feature with the command `USER="[YOURNAME]" tera --template data/include/hello.txt --include --env-only` and test *inheritance* feature with `USER="[YOURNAME]" tera --template data/inheritance/child.txt --inherit --env-only`.
From this repository, you can test the *include* feature with the command:

USER="[YOURNAME]" tera --template data/include/hello.txt --include --env-only

=== Output
and test the *inheritance* feature with:

By default,
USER="[YOURNAME]" tera --template data/inheritance/child.txt --inherit --env-only

=== Content escaping

Expand Down

0 comments on commit f0997b7

Please sign in to comment.