diff --git a/README.md b/README.md index b68ce1c..1a5059b 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,5 @@ A templating system engine for Docker - [Docker plugins](./docker-plugins/README.md) -- [CLI](./cli/README.md) \ No newline at end of file +- [CLI](./cli/README.md) +- [Go dependency](./core/README.md) \ No newline at end of file diff --git a/core/README.md b/core/README.md new file mode 100644 index 0000000..fcb67ea --- /dev/null +++ b/core/README.md @@ -0,0 +1,31 @@ +## Using Wharf as Go dependency + +Wharf let you create Dockerfiles from Dockerfile templates programmatically with Go. + +### Install the dependency + +```bash +go get -u github.com/Makepad-fr/wharf/core@latest +``` + +## Example use cases + +### Render the a Dockerfile template to a string + +```go +var stringBuilder strings.Builder +err := Render("../example/", "Dockerfile.template", "docker-values.yaml", &stringBuilder) +if err != nil { + t.Error(err) +} +``` +### Render the Dockerfile to a file + +```go +file, err := os.CreateTemp(os.TempDir(), "Dockerfile") + if err != nil { + t.Error(err) + } + defer ile.Close() + err = Render("../example", "Dockerfile.template", "docker-values.yaml", file) +``` \ No newline at end of file