Skip to content

Commit

Permalink
docs: Inlude example for build secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
cefeboru committed Jul 11, 2024
1 parent 09d0b9a commit d66bf38
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions content/compose/use-secrets.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

### Build Secrets

In the following example, the `npm_token` secret will be available at build time. It's value will be taken from the `NPM_TOKEN` environment variable.

```yaml
services:
myapp:
build:
secrets:
- npm_token
context: .
secrets:
npm_token:
environment: NPM_TOKEN
```

## Resources

- [Secrets top-level element](compose-file/09-secrets.md)
- [Secrets attribute for services top-level element](compose-file/05-services.md#secrets)
- [Build Secrets](https://docs.docker.com/build/building/secrets/)

0 comments on commit d66bf38

Please sign in to comment.