Skip to content
This repository has been archived by the owner on Jun 18, 2020. It is now read-only.

Commit

Permalink
feat: docker image and release process
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed May 18, 2018
1 parent e7979cd commit c6b3e88
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
vendor
do_sd.json
prometheus-digitalocean-sd
dist
10 changes: 10 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- amd64
dockers:
- image: totvslabs/prometheus-digitalocean-sd
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM gcr.io/distroless/base
COPY prometheus-digitalocean-sd /prometheus-digitalocean-sd
ENTRYPOINT ["/prometheus-digitalocean-sd"]

9 changes: 4 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ func main() {
a.HelpFlag.Short('h')
a.Version(version)
a.VersionFlag.Short('v')
a.Parse(os.Args[1:])
var ctx = context.Background()
kingpin.MustParse(a.Parse(os.Args[1:]))

var ctx = context.Background()
var client = godo.NewClient(oauth2.NewClient(ctx, oauth2.StaticTokenSource(
&oauth2.Token{
AccessToken: *doToken,
Expand Down Expand Up @@ -109,8 +109,7 @@ func toTargetList(nodes []godo.Droplet) ([]Target, error) {
if pvtIPAddr != "" {
labels[doLabelInstancePrivateIP] = model.LabelValue(pvtIPAddr)
}
var addr = net.JoinHostPort(ipAddr, fmt.Sprintf("%s", *servicePort))
// labels[model.AddressLabel] = model.LabelValue(addr) do we need that?
var addr = net.JoinHostPort(ipAddr, *servicePort)
labels[doLabelInstanceStatus] = model.LabelValue(node.Status)
labels[doLabelInstanceRegion] = model.LabelValue(node.Region.Slug)
labels[doLabelInstanceSize] = model.LabelValue(node.SizeSlug)
Expand All @@ -134,7 +133,7 @@ func write(data []Target) error {
if err != nil {
return errors.Wrap(err, "couldn't create temp file")
}
defer tmpfile.Close()
defer tmpfile.Close() // nolint: errcheck

_, err = tmpfile.Write(b)
if err != nil {
Expand Down

0 comments on commit c6b3e88

Please sign in to comment.