I have a service which transitively relies on some library (which is also being developed by me). The only way to test if the library changes are correct is to run the service.
I have two versions of that library:
vendor
folder GOPATH
So I can just remove it from vendor
and go build
will work correctly using the version from GOPATH
.
The question is what is the best way to achieve the same behavior using docker
?
The obvious solution is just copy of local GOPATH
into the container on build stage, but GOPATH
size is very big and such approach is too expensive.
Why don't you try to mount the library folder to container and define path in dockerfile, that way your image wont be large and the path will fetch you the dependent libraries from the mounted directory.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.