This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
FROM golang:1.22-alpine AS build
|
||||
|
||||
WORKDIR /build
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o shelly-exporter .
|
||||
|
||||
FROM alpine:3.20
|
||||
|
||||
RUN apk add --no-cache ca-certificates \
|
||||
&& addgroup -S exporter \
|
||||
&& adduser -S -G exporter exporter
|
||||
|
||||
WORKDIR /opt/shelly-exporter
|
||||
COPY --from=build /build/shelly-exporter ./shelly-exporter
|
||||
COPY config.example.yaml ./config.yaml
|
||||
|
||||
USER exporter
|
||||
EXPOSE 9090
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s \
|
||||
CMD wget -q -O - http://127.0.0.1:9090/-/healthy || exit 1
|
||||
|
||||
ENTRYPOINT ["./shelly-exporter"]
|
||||
CMD ["-config", "config.yaml"]
|
||||
Reference in New Issue
Block a user