Skip to content

Dockerfile: add ${GOPATH}/bin to $PATH#646

Merged
christos68k merged 2 commits intoopen-telemetry:mainfrom
grafana:korniltsev/dockerfile_path_update
Jul 22, 2025
Merged

Dockerfile: add ${GOPATH}/bin to $PATH#646
christos68k merged 2 commits intoopen-telemetry:mainfrom
grafana:korniltsev/dockerfile_path_update

Conversation

@korniltsev
Copy link
Copy Markdown
Contributor

This allows using the installed tools, such as porto in the docker dev container

root@3f484fa80ce1:/agent/src# make lint
GOARCH=arm64 go generate ./...
(cd support && ./generate.sh)
go: downloading github.com/jcchavezs/porto v0.7.0
types_gen.go
go: downloading golang.org/x/mod v0.21.0
bash: line 1: porto: command not found
(run: make vanity-import-fix)
make: *** [Makefile:100: vanity-import-check] Error 1

@korniltsev korniltsev requested review from a team as code owners July 22, 2025 03:45
Comment thread Dockerfile Outdated
ENV GOPATH="/agent/go"
ENV GOCACHE="/agent/.cache"
ENV PATH="/usr/local/go/bin:$PATH"
ENV PATH="/usr/local/go/bin:/agent/go/bin:$PATH"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When testing this change, I noticed, this modification of PATH only does have an effect for the creation of the docker image.
If you build and start this docker image, you will notice this by:

# echo $PATH
/usr/local/cargo/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

We might want to update the following line instead:

# Append to /etc/profile for login shells
RUN echo 'export PATH="/usr/local/go/bin:$PATH"' >> /etc/profile

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, yes, thanks for catching this.
Indeed, I wanted to have the variable in the container not during the build. I will update the change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, applied 12d168b

@christos68k christos68k merged commit 2dce0e2 into open-telemetry:main Jul 22, 2025
27 checks passed
gnurizen pushed a commit to parca-dev/opentelemetry-ebpf-profiler that referenced this pull request Sep 11, 2025
gnurizen pushed a commit to parca-dev/opentelemetry-ebpf-profiler that referenced this pull request Sep 11, 2025
gnurizen pushed a commit to parca-dev/opentelemetry-ebpf-profiler that referenced this pull request Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants