You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
go: document libc and ca-certificates.crt dependencies? #1
When applying the examples for the go builder to my project, I ran into two problems:
By default, the binary depends on libc (some version of musl it seems?). This can be worked around by adding env: ["CGO_ENABLED=0"].
If you make HTTPS connections, it needs /etc/ssl/certs/ca-certificates.crt for the trusted root certificates.
I think this is mostly a documentation oversight. I think it could be "solved" in any of the following ways:
Document these dependencies/limitations in go/README.md?
Recommend that people use the golang-project builder and not go. I think golang-project sets an alpine base image in the Dockerfile by default, which would avoid this.
Document the alpine base image that is used by the builder, so we could add it as the correct base instead of scratch?
Ship a minimal base image that includes the correct libc version and ca-certificates.crt in the correct location, so we could use that instead of alpine (probably overkill; this makes tiny binaries, but adds maintenance burden).
Fair point: Re: certificates: It is up to the user to configure their image correctly; I just wish it was somehow more obvious that the binary alone is not sufficient, that said: there are lots of guides about including it. Maybe an easy fix is to have the examples reference a more complete base image instead of scratch, so that if someone like me just copies an example and tries to use it, its more likely to work correctly? A user who wants to cut down their image size is then on their own (or can reference the various Internet guides about it).
libc is more difficult: with the current container builder, its looking for some version of musl, and it isn't clear how to find the right one. Disabling cgo works, but is also not ideal: I have things that use sqlite, and it might be nice to use the cloud builder with them.
Anyway, thanks, feel free to close this as you see fit.
Check out the changes just pushed and let me know what you think. They're live in production now.
I'm also considering having a go:alpine and go:debian as separate builders - then we'd avoid the CGO_ENABLED=0 requirement and you could have your sqlite fun.
These are awesome fixes; thank you! Definitely above and beyond my suggestions. I love the https example. Thanks, I'm closing this issue (see git commit add2207 for future reference)
Heads up - we're going to stop setting CGO_ENABLED=0 and instead have a gcr.io/cloud-builders/go:alpine and gcr.io/cloud-builders/go:wheezy build step, with gcr.io/cloud-builders/go=gcr.io/cloud-builders/go:alpine as a default.
Activity
skelterjohn commentedon Jan 13, 2017
Thanks for the feedback, evanj.
I've already got something in the works for CGO_ENABLED=0, I'll try to roll that out soon.
For the cert issue, I'm not sure how I can address that in the go builder, which only creates a binary which relies on its container to have certs.
I like your suggestion about the example, I'll take care of it.
evanj commentedon Jan 13, 2017
Fair point: Re: certificates: It is up to the user to configure their image correctly; I just wish it was somehow more obvious that the binary alone is not sufficient, that said: there are lots of guides about including it. Maybe an easy fix is to have the examples reference a more complete base image instead of scratch, so that if someone like me just copies an example and tries to use it, its more likely to work correctly? A user who wants to cut down their image size is then on their own (or can reference the various Internet guides about it).
libc is more difficult: with the current container builder, its looking for some version of
musl, and it isn't clear how to find the right one. Disabling cgo works, but is also not ideal: I have things that use sqlite, and it might be nice to use the cloud builder with them.Anyway, thanks, feel free to close this as you see fit.
Use CGO_ENABLED for the go tool builder to avoid alpine musl issues.
skelterjohn commentedon Jan 18, 2017
Check out the changes just pushed and let me know what you think. They're live in production now.
I'm also considering having a go:alpine and go:debian as separate builders - then we'd avoid the CGO_ENABLED=0 requirement and you could have your sqlite fun.
evanj commentedon Jan 18, 2017
These are awesome fixes; thank you! Definitely above and beyond my suggestions. I love the https example. Thanks, I'm closing this issue (see git commit add2207 for future reference)
skelterjohn commentedon Jan 19, 2017
Heads up - we're going to stop setting CGO_ENABLED=0 and instead have a gcr.io/cloud-builders/go:alpine and gcr.io/cloud-builders/go:wheezy build step, with gcr.io/cloud-builders/go=gcr.io/cloud-builders/go:alpine as a default.
Merge pull request #1 from GoogleCloudPlatform/master
Merge pull request GoogleCloudPlatform#1 from oliverxchen/manage_cache