| 1 |
FROM --platform=$BUILDPLATFORM golang:1.23.4-alpine AS builder |
| 2 |
|
| 3 |
ARG TARGETOS |
| 4 |
ARG TARGETARCH |
| 5 |
|
| 6 |
ENV GOOS=$TARGETOS |
| 7 |
ENV GOARCH=$TARGETARCH |
| 8 |
|
| 9 |
RUN apk add --no-cache make git bash |
| 10 |
|
| 11 |
WORKDIR /build |
| 12 |
|
| 13 |
COPY go.mod go.sum /build/ |
| 14 |
RUN go mod download |
| 15 |
RUN go mod verify |
| 16 |
|
| 17 |
COPY . /build/ |
| 18 |
RUN make build-binary |
| 19 |
|
| 20 |
FROM --platform=$TARGETPLATFORM busybox |
| 21 |
LABEL maintainer="Robert Jacob <[email protected]>" |
| 22 |
|
| 23 |
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt |
| 24 |
COPY --from=builder /build/nextcloud-exporter /bin/nextcloud-exporter |
| 25 |
|
| 26 |
USER nobody |
| 27 |
EXPOSE 9205 |
| 28 |
|
| 29 |
ENTRYPOINT ["/bin/nextcloud-exporter"] |