Skip to content

Commit

Permalink
dockerfile: remove gopath override
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Gandem committed Nov 14, 2024
1 parent 3ecb708 commit 9921f00
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ FROM golang:1.23.1-bookworm@sha256:dba79eb312528369dea87532a65dbe9d4efb26439a0fe

RUN apt-get update -y && apt-get upgrade -y && apt-get install -y sudo && apt-get clean autoclean && apt-get autoremove --yes

RUN go install github.com/golangci/golangci-lint/cmd/[email protected]

ENV GOPATH=

RUN useradd -ms /bin/bash build
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
RUN adduser build sudo

USER build

RUN go install github.com/golangci/golangci-lint/cmd/[email protected]

VOLUME /go

0 comments on commit 9921f00

Please sign in to comment.