GithubHelp home page GithubHelp logo

Comments (13)

tianon avatar tianon commented on May 10, 2024 3

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.

yosifkit avatar yosifkit commented on May 10, 2024

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.

spagettikod avatar spagettikod commented on May 10, 2024

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.

tianon avatar tianon commented on May 10, 2024

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.

spagettikod avatar spagettikod commented on May 10, 2024

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.

spagettikod avatar spagettikod commented on May 10, 2024

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.

tianon avatar tianon commented on May 10, 2024

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.

spagettikod avatar spagettikod commented on May 10, 2024

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.

ns-cweber avatar ns-cweber commented on May 10, 2024

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.

tianon avatar tianon commented on May 10, 2024

from golang.

zachgrayio avatar zachgrayio commented on May 10, 2024

@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.

tianon avatar tianon commented on May 10, 2024

@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.

zachgrayio avatar zachgrayio commented on May 10, 2024

@tianon Awesome, I'll take a look, thanks for the infos!

from golang.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.