Comments (13)
If you:
$ echo 'github.com/spagettikod/comindoo-api' > .godir
these woes will likely disappear and you'll be able to use the onbuild as-is.
from golang.
Both options below would require you to copy the onbuild
dockerfile and remove ONBUILD
from the commands.
The most secure way is to checkout the repository you need to install beforehand and just COPY
it in before the go install
(that way you use your ssh keys and no credentials are stored in the image).
The other way is to COPY
in a private and public key that has access to pull the repositories in question. This is less secure because the keys will be forever embedded in that image (even if removed at a later RUN
), they are not deleted, just "hidden" in that file system layer, but still accessible if you run a container from that lower image layer.
from golang.
Actually there is no real need to get anything on my part since all dependencies are vendored using godep. But I guess this is controlled from go. Maybe I should create my own onbuild without the download step to solve this?
from golang.
That could work, or you could simply duplicate the steps there and prefix them with something like this:
ENV GOPATH $GOPATH:/usr/src/app/vendor
from golang.
I created my own version of golang:1.3.3-latest where all I did was remove ONBUILD RUN go-wrapper download
. This gets me past the go get
failure but now go install
fails for all my vendored dependencies.
authentication.go:12:2: cannot find package "github.com/spagettikod/comindoo-api/Godeps/_workspace/src/code.google.com/p/go.crypto/bcrypt" in any of:
/usr/src/go/src/pkg/github.com/spagettikod/comindoo-api/Godeps/_workspace/src/code.google.com/p/go.crypto/bcrypt (from $GOROOT)
/go/src/github.com/spagettikod/comindoo-api/Godeps/_workspace/src/code.google.com/p/go.crypto/bcrypt (from $GOPATH)
My import look like this:
import "github.com/spagettikod/comindoo-api/Godeps/_workspace/src/code.google.com/p/go.crypto/bcrypt"
from golang.
It seemed obvious but I did a small test with a sub package to try out building sub packages. Same error as above. Put the source code in a Gist, https://gist.github.com/spagettikod/8a5cc7f518fad13b5df9
from golang.
On 2 December 2014 at 13:14, Roland Bali [email protected] wrote:
Thanks that did the trick when installing when adding it to my own copy of golang-onbuild. But I guess I still need a custom golang-onbuild to skip the go get step?
If you've got the ".godir" set properly and all your imports are the
long-form you've mentioned above, the "go get" will be a noop, and
will actually give you a nice indication of when you've missed
long-forming an import. :)
from golang.
Removed the comment you are referring to since I realised I didn't run it correctly. Ran the echo command and checked in .godir with the rest of my source and everything works like a charm! :)
Thanks for all the help!
from golang.
I'm having a similar problem, except my dependency is in the same repo as the service, just in a directory ../database
relative to the Dockerfile that needs it. I don't want to version it because I'm planning to rapidly iterate on the dependency and the service that needs it, and I don't want to have to update the vendor version all the time. I also can't make it a subdirectory of the service that uses it because there's another service that uses it as well. I'm not familiar with Docker, so maybe I'm missing something obvious?
from golang.
from golang.
@tianon The .godir trick is quite handy, though it took a bit of digging to come across it in relation to Golang+Docker issues, wondering if this is documented anywhere else? and if not, maybe it should be?
from golang.
@zachgrayio we don't actually recommend .godir
anymore (and it was never actually documented), since Go now supports "Custom Import Paths", which we lightly mention on https://hub.docker.com/_/golang/:
(or
CMD ["myapp"]
if a Go custom import path is in use)
Regardless, https://golang.org/s/go14customimport is a good read, and I highly recommend it.
from golang.
@tianon Awesome, I'll take a look, thanks for the infos!
from golang.
Related Issues (20)
- Add `1.X-debian-stable` type alias HOT 3
- Specifying GOTOOLCHAIN in golang:alpine fails HOT 4
- golang 1.19.13 image HOT 4
- Docker Hub not showing new images
- Something is not right with `GOARM` HOT 5
- Add patch binary to golang images HOT 1
- README should mention about Go telemetry HOT 2
- [regression] cgo/boringssl builds not working on alpine 3.19 HOT 4
- cwe vulnerabilities golang:1.21.5-alpine3.18 -19 HOT 3
- golang:1.21.5 on linux/arm/v6 : no match for platform in manifest HOT 7
- Docker Scout reports CVE's HOT 1
- go tool pprof not working HOT 3
- Resolve common CVEs HOT 4
- `golang:1.21.7` does not have an `linux/amd64` image HOT 3
- `golang:1.22.0-bullseye` `linux/amd64` reports dpkg architecture `i386` HOT 6
- golang:1.22-alpine is linux/386 instead of linux/amd64 HOT 2
- incorrect version of gcc HOT 4
- Despite build passed, amd64 is missing on golang:1.22.0-alpine3.18 HOT 2
- Add go-task to this imge HOT 1
- Tags keep flip-flopping between two digests HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from golang.