Merge pull request #241 from vishh/dns_lookup
Avoid compiling cadvisor statically for the docker image
This commit is contained in:
commit
ea583d0b0c
11
cadvisor.go
11
cadvisor.go
@ -93,8 +93,9 @@ func main() {
|
||||
|
||||
defer glog.Flush()
|
||||
|
||||
errChan := make(chan error)
|
||||
go func() {
|
||||
glog.Fatal(containerManager.Start())
|
||||
errChan <- containerManager.Start()
|
||||
}()
|
||||
|
||||
glog.Infof("Starting cAdvisor version: %q", info.VERSION)
|
||||
@ -102,7 +103,13 @@ func main() {
|
||||
|
||||
addr := fmt.Sprintf(":%v", *argPort)
|
||||
|
||||
glog.Fatal(http.ListenAndServe(addr, nil))
|
||||
go func() {
|
||||
errChan <- http.ListenAndServe(addr, nil)
|
||||
}()
|
||||
select {
|
||||
case err := <-errChan:
|
||||
glog.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func setMaxProcs() {
|
||||
|
@ -1,11 +1,8 @@
|
||||
FROM scratch
|
||||
MAINTAINER dengnan@google.com vmarmol@google.com
|
||||
|
||||
# NOTE: Run prepare.sh before building this Docker image.
|
||||
FROM progrium/busybox
|
||||
MAINTAINER dengnan@google.com vmarmol@google.com vishnuk@google.com
|
||||
|
||||
# Grab cadvisor from the staging directory.
|
||||
ADD cadvisor /usr/bin/cadvisor
|
||||
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["/usr/bin/cadvisor"]
|
||||
CMD ["-log_dir", "/"]
|
||||
|
8
deploy/build.sh
Executable file
8
deploy/build.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
godep go build -a github.com/google/cadvisor
|
||||
|
||||
sudo docker build -t google/cadvisor:test .
|
@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
# Statically build cAdvisor from source and stage it.
|
||||
godep go build -a --ldflags '-extldflags "-static"' github.com/google/cadvisor
|
@ -19,6 +19,7 @@ import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/google/cadvisor/info"
|
||||
"github.com/google/cadvisor/storage"
|
||||
)
|
||||
@ -104,7 +105,9 @@ func (self *InMemoryStorage) AddStats(ref info.ContainerReference, stats *info.C
|
||||
// TODO(monnand): To deal with long delay write operations, we
|
||||
// may want to start a pool of goroutines to do write
|
||||
// operations.
|
||||
self.backend.AddStats(ref, stats)
|
||||
if err := self.backend.AddStats(ref, stats); err != nil {
|
||||
glog.Error(err)
|
||||
}
|
||||
}
|
||||
return cstore.AddStats(stats)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user