From 82152d030d9196aca948fad78513ab391f3fae9b Mon Sep 17 00:00:00 2001 From: Mayuresh Gaitonde Date: Thu, 13 May 2021 23:54:52 -0700 Subject: [PATCH] Fix dockerfile --- Dockerfile | 13 +++++++------ controller/app.go | 5 +++++ controller/monitor.go | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index e4e75a7..bcfdb58 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,18 +3,19 @@ RUN apk update && \ apk upgrade && \ apk add --no-cache git && \ apk add make -RUN mkdir -p /opt/gocast -RUN mkdir -p /go/src/github.com/mayuresh82 -RUN cd /go/src/github.com/mayuresh82 && \ - git clone https://github.com/mayuresh82/gocast + +RUN mkdir -p /go/src/github.com/mayuresh82/gocast + +COPY . /go/src/github.com/mayuresh82/gocast + WORKDIR /go/src/github.com/mayuresh82/gocast + RUN make -RUN cp gocast /opt/gocast/ FROM alpine:latest RUN apk --no-cache add ca-certificates bash iptables netcat-openbsd sudo WORKDIR /root/ -COPY --from=builder /opt/gocast/gocast . +COPY --from=builder /go/src/github.com/mayuresh82/gocast . EXPOSE 8080/tcp diff --git a/controller/app.go b/controller/app.go index af676e3..ceedf1f 100644 --- a/controller/app.go +++ b/controller/app.go @@ -71,6 +71,11 @@ func (a *App) Equal(other *App) bool { return a.Name == other.Name && a.Vip.Net.String() == other.Vip.Net.String() } +func (a *App) String() string { + return fmt.Sprintf("Name: %s, Vip: %s, VipConf: %v, Monitors: %v, Nats: %v, Source: %s", + a.Name, a.Vip.Net.String(), a.VipConfig, a.Monitors, a.Nats, a.Source) +} + func NewApp(appName, vip string, vipConfig config.VipConfig, monitors []string, nats []string, source string) (*App, error) { if appName == "" { return nil, fmt.Errorf("Invalid app name") diff --git a/controller/monitor.go b/controller/monitor.go index d5fa333..392e984 100644 --- a/controller/monitor.go +++ b/controller/monitor.go @@ -168,7 +168,7 @@ func (m *MonitorMgr) Add(app *App) { appMon := &appMon{app: app, done: make(chan bool)} m.monitors[app.Name] = appMon go m.runLoop(appMon) - glog.Infof("Registered a new app: %v", app) + glog.Infof("Registered a new app: %v", app.String()) } // Remove removes an app from monitor manager, stops BGP