Skip to content

Add small snippet for build secrets #1994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions apps/build-secrets.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

You can set [secrets](/docs/apps/secrets/) for your applications, but these are only available at _run-time_. They aren't available when building your Docker image without a little extra work.

Use the `build_` prefix when setting a secret with `fly secrets set` to make it available only at build time.
```bash
fly secrets set build_MY_SUPER_SECRET=some_value
```
To make a secret available at build time, we'll use [Docker secrets](https://docs.docker.com/develop/develop-images/build_enhancements/).

It's a 2-step process:
Expand Down Expand Up @@ -96,7 +100,7 @@
some_command
```

Assuming your builder Dockerfile is named `Dockerfile.builder`, you can launch the emphemeral machine using the following command:

Check warning on line 103 in apps/build-secrets.html.md

View workflow job for this annotation

GitHub Actions / Vale linter

[vale] reported by reviewdog 🐶 [Fly.Spelling] Is 'emphemeral' a typo? Raw Output: {"message": "[Fly.Spelling] Is 'emphemeral' a typo?", "location": {"path": "apps/build-secrets.html.md", "range": {"start": {"line": 103, "column": 84}}}, "severity": "INFO"}

Check warning on line 103 in apps/build-secrets.html.md

View workflow job for this annotation

GitHub Actions / Vale linter

[vale] reported by reviewdog 🐶 [Fly.Machine] Use 'Machine' instead of ' machine'. Raw Output: {"message": "[Fly.Machine] Use 'Machine' instead of ' machine'.", "location": {"path": "apps/build-secrets.html.md", "range": {"start": {"line": 103, "column": 94}}}, "severity": "INFO"}

```cmd
flyctl console --dockerfile Dockerfile.builder -C "/srv/deploy.sh" --env=FLY_API_TOKEN=$(fly auth token)
Expand Down
Loading