If you already ran `go mod vendor` outside of docker then there's no need 
for multilayer caching

COPY . .
RUN go build 

On Thursday, September 2, 2021 at 3:54:54 AM UTC+2 kis...@gmail.com wrote:

> I'm trying to make docker build faster for software that are built with 
> golang
> tried to cache layer but it still slow when dependency changed since go 
> mod download have to redownload whole dependency again and again.
>
> how to make use vendor directory on docker  build? (where to copy? so go 
> build or go mod download/go mod vendor inside Dockerfile so it doesn't 
> redownload agian and again)?
> I've tried to copy whole vendor, but it still redownloading
> tried to copy vendor to $GOPATH/pkg/mod, but it also still redownloading
> tried to copy vendor to $GOPATH/pkg/mod/cache/download, but it still 
> redownloading
> where the correct way to put vendor directory?
>
>
> https://stackoverflow.com/questions/69020535/how-to-prevent-docker-build-from-redownloading-copied-golang-vendor
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/6610b0fc-ad47-433d-841e-e1fe1b29a328n%40googlegroups.com.

Reply via email to