1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-03 13:11:48 +02:00

docs: Add documentation for docker build_flag_templates

See #813
This commit is contained in:
Albert Salim 2018-10-03 21:11:40 +08:00 committed by Carlos Alexandro Becker
parent 94f88bac84
commit 5c504024b1

View File

@ -66,6 +66,12 @@ dockers:
- "{{ .Tag }}-{{ .Env.GO_VERSION }}"
- "v{{ .Major }}"
- latest
# Template of the docker build flags.
build_flag_templates:
- "--label=org.label-schema.schema-version=1.0"
- "--label=org.label-schema.version={{.Version}}"
- "--label=org.label-schema.name={{.ProjectName}}"
- "--build-arg=FOO={{.ENV.Bar}}"
# If your Dockerfile copies files other than the binary itself,
# you should list them here as well.
extra_files:
@ -106,3 +112,29 @@ This will build and publish the following images:
With these settings you can hopefully push several different docker images
with multiple tags.
## Applying docker build flags
Build flags can be applied using `build_flag_templates`. The flags must be
valid docker build flags.
```yaml
# .goreleaser.yml
dockers:
-
binary: mybinary
image: myuser/myimage
build_flag_templates:
- "--label=org.label-schema.schema-version=1.0"
- "--label=org.label-schema.version={{.Version}}"
- "--label=org.label-schema.name={{.ProjectName}}"
```
This will execute the following command:
```bash
docker build -t myuser/myimage . \
--label=org.label-schema.schema-version=1.0 \
--label=org.label-schema.version=1.6.4 \
--label=org.label-schema.name=mybinary"
```