From 9921f00248d6ff7754d33c98fde2d85a5a3f1237 Mon Sep 17 00:00:00 2001 From: Nayef Ghattas Date: Thu, 14 Nov 2024 09:24:01 +0000 Subject: [PATCH] dockerfile: remove gopath override 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. --- Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 419332f..1a98097 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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/golangci-lint@v1.61.0 - -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/golangci-lint@v1.61.0 + +VOLUME /go