Commit aa31130
committed
fix(Dockerfile): make sure we run as a user
When we start the current code from the container build, we're getting
```console
Error: unable to set up OpenTelemetry SDK: failed to create initial resources: error detecting resource: user: Current requires cgo or $USER set in environment
```
This is because, in commit 09b72e0, we
added `resource.WithProcess()` to include process information in the
exported resources. One of the fields this looks up is the username of
the process's UID. Since we are using a `scratch` image, unless we put
them there there are no users or groups present. The `os/user` package
errors with the message above if it can't find the user.
The minimal fix we're doing here is to create a user and a group for us
to run as, so that this lookup succeeds inside the container.1 parent f831373 commit aa31130
1 file changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
23 | 33 | | |
24 | 34 | | |
25 | 35 | | |
| |||
0 commit comments