Skip to content
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

dockerfile: remove gopath override #42

Merged
merged 1 commit into from
Nov 14, 2024
Merged

dockerfile: remove gopath override #42

merged 1 commit into from
Nov 14, 2024

Conversation

Gandem
Copy link
Member

@Gandem Gandem commented Nov 14, 2024

What does this PR do?

Move the go install command so that it's called by the build user instead of root.

Running go install with root would lead to some folders in /go/pkg/ being owned by root and not writable by the build user, which eventually leads to permission errors when building the profiler, specifically to download new dependencies.

Also put /go in a volume which is persisted between consecutive runs, meaning docker-compose restart will reuse the go cache / go dependencies speeding up builds for local development.

Motivation

Speed up local builds, fix permissions for /go directory.

Additional Notes

N/A

How to test the change?

Tested locally with:

docker-compose build
docker-compose up -d --force-recreate
# wait for a bit
docker-compose restart

And verifying that all commands work, containers are started as expected, and during restart go dependencies are not fetched again.

move the go install command so that it's called by the build user
instead of root.

running go install with root would lead to some folders in /go/pkg/
being owned by root and not writable by the build user, which eventually
leads to permission errors when building the profiler, specifically to
download new dependencies.

also put /go in a volume which is persisted between consecutive runs,
meaning docker-compose restart will reuse the go cache / go dependencies
speeding up builds for local development.
@Gandem Gandem requested a review from a team as a code owner November 14, 2024 09:28
@Gandem Gandem enabled auto-merge (squash) November 14, 2024 09:33
@Gandem Gandem merged commit 686f7d1 into main Nov 14, 2024
10 checks passed
@Gandem Gandem deleted the nayef/gocache branch November 14, 2024 09:58
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.

2 participants