mirror of https://github.com/docker/docs.git
docs(compose): Inlude example for build secrets on the use-secrets doc (#20403)
* docs: Inlude example for build secrets * Apply suggestions from code review --------- Co-authored-by: Allie Sadler <102604716+aevesdocker@users.noreply.github.com>
This commit is contained in:
parent
bfd8501fb3
commit
e6847231e2
|
@ -84,7 +84,25 @@ In the advanced example above:
|
||||||
>
|
>
|
||||||
> The `_FILE` environment variables demonstrated here are a convention used by some images, including Docker Official Images like [mysql](https://hub.docker.com/_/mysql) and [postgres](https://hub.docker.com/_/postgres).
|
> The `_FILE` environment variables demonstrated here are a convention used by some images, including Docker Official Images like [mysql](https://hub.docker.com/_/mysql) and [postgres](https://hub.docker.com/_/postgres).
|
||||||
|
|
||||||
|
### Build secrets
|
||||||
|
|
||||||
|
In the following example, the `npm_token` secret is made available at build time. It's value is taken from the `NPM_TOKEN` environment variable.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
services:
|
||||||
|
myapp:
|
||||||
|
build:
|
||||||
|
secrets:
|
||||||
|
- npm_token
|
||||||
|
context: .
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
npm_token:
|
||||||
|
environment: NPM_TOKEN
|
||||||
|
```
|
||||||
|
|
||||||
## Resources
|
## Resources
|
||||||
|
|
||||||
- [Secrets top-level element](compose-file/09-secrets.md)
|
- [Secrets top-level element](compose-file/09-secrets.md)
|
||||||
- [Secrets attribute for services top-level element](compose-file/05-services.md#secrets)
|
- [Secrets attribute for services top-level element](compose-file/05-services.md#secrets)
|
||||||
|
- [Build secrets](https://docs.docker.com/build/building/secrets/)
|
||||||
|
|
Loading…
Reference in New Issue