From c92932078257fbcd3819453d85a1a44376a65aa6 Mon Sep 17 00:00:00 2001 From: Frank Schroeder Date: Wed, 6 Dec 2017 00:13:16 +0100 Subject: [PATCH] docs: env support for docker tag_template Update docs for tag_template. --- docs/130-docker.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/130-docker.md b/docs/130-docker.md index bc274899f..ab85a4aba 100644 --- a/docs/130-docker.md +++ b/docs/130-docker.md @@ -51,7 +51,7 @@ dockers: # Path to the Dockerfile (from the project root). dockerfile: Dockerfile # Template of the docker tag. Defaults to `{{ .Version }}`. Other allowed - # fields are `.Tag`. + # fields are `.Tag` and `.Env.VARIABLE_NAME`. tag_template: "{{ .Tag }}" # Also tag and push myuser/myimage:latest. latest: true @@ -64,3 +64,20 @@ dockers: These settings should allow you to generate multiple Docker images, for example, using multiple `FROM` statements, as well as generate one image for each binary in your project. + +## Passing environment variables to tag_template + +You can do that by using `{{ .Env.VARIABLE_NAME }}` in the template, for +example: + +```yaml +dockers: + - + tag_template: "{{ .Tag }}-{{ .Env.GOVERSION_NR }}" +``` + +Then you can run: + +```console +GOVERSION_NR=$(go version | awk '{print $3}') goreleaser +```