Skip to content

Commit

Permalink
Merge pull request #14 from bringg/makefile
Browse files Browse the repository at this point in the history
Add Makefile and upgrade dependencies
  • Loading branch information
shamil committed Dec 19, 2023
2 parents 1755927 + 547685b commit c5dd0bb
Show file tree
Hide file tree
Showing 5 changed files with 220 additions and 491 deletions.
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work

# Binary
caexporter
15 changes: 7 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
FROM golang:1.19-alpine as builder
FROM golang:1.21-alpine as builder

ARG caexporter_version=0.0.2

RUN apk --no-cache add git
RUN apk --no-cache add git make

WORKDIR /opt/caexporter
COPY . .
RUN go build -ldflags="-X github.com/prometheus/common/version.Version=${caexporter_version}} -X github.com/prometheus/common/version.Revision=$(git rev-parse HEAD) -X github.com/prometheus/common/version.Branch=$(git branch --show-current)" ./
RUN make build


FROM alpine:3.16
FROM gcr.io/distroless/static
LABEL maintainer "Bringg DevOps <devops@bringg.com>"

USER nobody

COPY --from=builder /opt/caexporter/caexporter /usr/local/bin
COPY --from=builder /opt/caexporter/caexporter /

ENTRYPOINT ["caexporter"]
ENTRYPOINT ["/caexporter"]
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
VERSION := 0.0.4
GIT_COMMIT := $(shell git rev-parse --short HEAD)
GIT_BRANCH := $(shell git branch --show-current)

.PHONY: build
build:
@echo "==> Building ..."
@go build -ldflags="-X github.com/prometheus/common/version.Version=$(VERSION) -X github.com/prometheus/common/version.Revision=$(GIT_COMMIT) -X github.com/prometheus/common/version.Branch=$(GIT_BRANCH)" .

.PHONY: upgrade-deps
upgrade-deps:
@echo "==> Upgrading dependencies..."
@go get -t -u ./...
@go mod tidy

.PHONY: dependencies
dependencies:
@echo "==> Downloading dependencies..."
@go mod download -x
70 changes: 41 additions & 29 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,46 +1,58 @@
module github.com/bringg/caexporter

go 1.19
go 1.21

require (
github.com/prometheus/client_golang v1.11.1
github.com/prometheus/common v0.26.0
github.com/rs/zerolog v1.22.0
k8s.io/apimachinery v0.20.4
k8s.io/client-go v0.20.4
github.com/prometheus/client_golang v1.17.0
github.com/prometheus/common v0.45.0
github.com/rs/zerolog v1.31.0
k8s.io/apimachinery v0.29.0
k8s.io/client-go v0.29.0
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-logr/logr v0.2.0 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.20.1 // indirect
github.com/go-openapi/jsonreference v0.20.3 // indirect
github.com/go-openapi/swag v0.22.5 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.4.3 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/googleapis/gnostic v0.4.1 // indirect
github.com/imdario/mergo v0.3.5 // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/oauth2 v0.15.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e // indirect
google.golang.org/appengine v1.6.5 // indirect
google.golang.org/protobuf v1.26.0-rc.1 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
k8s.io/api v0.20.4 // indirect
k8s.io/klog/v2 v2.4.0 // indirect
k8s.io/utils v0.0.0-20201110183641-67b214c5f920 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.0.2 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.29.0 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20231214164306-ab13479f8bf8 // indirect
k8s.io/utils v0.0.0-20231127182322-b307cd553661 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
Loading

0 comments on commit c5dd0bb

Please sign in to comment.