mirror of
https://github.com/prometheus-community/windows_exporter
synced 2024-12-24 15:32:11 +00:00
Add cross OS Dockerfile
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
parent
569f5450cd
commit
7331dc2394
22
Dockerfile.cross
Normal file
22
Dockerfile.cross
Normal file
@ -0,0 +1,22 @@
|
||||
# Build this Docker Image on any platform with
|
||||
# docker buildx build -t a --platform=windows/amd64 .
|
||||
|
||||
ARG BASE=mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0
|
||||
|
||||
FROM --platform=$BUILDPLATFORM golang:1.21 as builder
|
||||
ARG TARGETARCH
|
||||
ARG TARGETOS
|
||||
|
||||
# Get dependencies
|
||||
WORKDIR /w
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
RUN go install github.com/prometheus/promu@latest
|
||||
|
||||
# Build windows_exporter
|
||||
COPY . ./
|
||||
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH make windows_exporter.exe
|
||||
|
||||
FROM $BASE
|
||||
COPY --from=builder /w/windows_exporter.exe /windows_exporter.exe
|
||||
ENTRYPOINT ["windows_exporter.exe"]
|
Loading…
Reference in New Issue
Block a user