diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 15dbca3..0000000 --- a/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM golang:alpine as build - -WORKDIR /root -COPY . /root -RUN go install golang.org/x/tools/cmd/stringer@latest && go generate ./... && go build . - -FROM alpine:latest - -ENV LISTEN_ADDRESS="0.0.0.0" LISTEN_PORT="9452" - -RUN addgroup -S mystrom \ - && adduser -S mystrom -G mystrom \ - && mkdir /app \ - && chown -R mystrom:mystrom /app - -WORKDIR /app -USER mystrom -COPY --from=build /root/mystrom-exporter /app - -CMD /app/mystrom-exporter -web.listen-address $LISTEN_ADDRESS:$LISTEN_PORT \ No newline at end of file diff --git a/Makefile b/Makefile index daa18af..c0ca732 100644 --- a/Makefile +++ b/Makefile @@ -21,36 +21,28 @@ LDFLAGS := -w -s \ -X $(versionPkgPrefix).BuildUser=${builduser} \ -X $(versionPkgPrefix).BuildDate=${builddate} GOFLAGS := -v -GOX_FLAGS := -mod=vendor GO_BUILD_FLAGS := -v export GO111MODULE := on -build: go-tools generate ## builds the all platform binaries of the exporter - $(GOPATH)/bin/gox \ - -os="darwin linux" \ - -arch="amd64 arm arm64" \ - -osarch="!darwin/arm" \ - -output "${BINDIR}/{{.Dir}}-{{.OS}}-{{.Arch}}" \ - -gcflags "$(GO_BUILD_FLAGS)" \ - -ldflags '$(LDFLAGS)' \ - -tags '$(TAGS)' \ - ./... +build: go-tools generate ## build mystrom-exporter for your local system + $(GO) build \ + -o ${BINDIR}/mystrom-exporter \ + -gcflags "$(GO_BUILD_FLAGS)" \ + -ldflags '$(LDFLAGS)' \ + -tags '$(TAGS)' \ + . run: - ${BINDIR}/mystrom-exporter-$(shell $(GO) env GOOS)-$(shell $(GO) env GOARCH) - + ${BINDIR}/mystrom-exporter generate: go-tools $(GO) generate ./... -go-tools: $(GOPATH)/bin/stringer $(GOPATH)/bin/gox +go-tools: $(GOPATH)/bin/stringer # -- see more info on https://pkg.go.dev/golang.org/x/tools/cmd/stringer $(GOPATH)/bin/stringer: $(GO) install golang.org/x/tools/cmd/stringer@latest -$(GOPATH)/bin/gox: - $(GO) install github.com/mitchellh/gox@latest -# -- help: @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'