Skip to content

Commit

Permalink
Fix the build
Browse files Browse the repository at this point in the history
Clean the Dockerfile
  • Loading branch information
gicamm committed Dec 18, 2024
1 parent d9cf9e6 commit 23945ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 24 deletions.
27 changes: 5 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,18 @@
FROM ubuntu:16.04 as buildstage
FROM golang:1.23.4-alpine AS buildstage

# Install git, curl and build required packages
RUN apt-get update -y && apt-get install -y git curl make gcc tar rsync wget

# Download Go and install it to /usr/local/go
RUN curl -s https://storage.googleapis.com/golang/go1.19.10.linux-amd64.tar.gz | tar -v -C /usr/local -xz
ENV PATH $PATH:/usr/local/go/bin
RUN apk update && apk add make gcc git curl

# Enable go modules
ENV GO111MODULE on
RUN go env -w GOPRIVATE=github.com/platinasystems/*

# Enable access to private github repositories
# Token must be passed with --build-arg GITHUB_TOKEN=<value>
ARG GITHUB_TOKEN
RUN git config --global url."https://$GITHUB_TOKEN:[email protected]/".insteadOf "https://github.com/"

# Populate the module cache based on the go.{mod,sum} files for ipmi_exporter
COPY go.mod go.mod
RUN go mod download
ENV GO111MODULE=on

#Build ipmi_exporter
WORKDIR /$GOPATH/src/github.com/platinasystems/ipmi_exporter
COPY . .
RUN make
RUN make precheck style unused build
RUN mv ipmi_exporter /

#Copy the ipmi_expoter binary
ARG ARCH="amd64"
ARG OS="linux"
FROM --platform=${OS}/${ARCH} alpine:3
FROM alpine:3
RUN apk --no-cache add freeipmi
LABEL maintainer="The Prometheus Authors <[email protected]>"
WORKDIR /
Expand Down
3 changes: 1 addition & 2 deletions collector_sel_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,9 @@ func (c SELEventsCollector) Collect(result freeipmi.Result, ch chan<- prometheus

log, err := freeipmi.GetStringSELEvents(result)
if err != nil {
level.Error(logger).Log("msg", "Failed to collect SEL events logs", "target", targetName(target.host), "error", err)
logger.Error("Failed to collect SEL events logs", "target", targetName(target.host), "error", err)
return 0, err
}
level.Info(logger).Log(log)

ch <- prometheus.MustNewConstMetric(
selEventsLog,
Expand Down

0 comments on commit 23945ac

Please sign in to comment.