forked from DaspawnW/prometheus-aws-discovery
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
40 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
FROM golang:1.19-alpine as builder | ||
FROM --platform=$BUILDPLATFORM golang:1.19-alpine as builder | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
ARG RELEASE_VERSION=development | ||
|
||
# Install our build tools | ||
RUN apk add --update git make bash ca-certificates | ||
|
||
WORKDIR /go/src/github.com/daspawnw/prometheus-aws-discovery | ||
COPY . ./ | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-X 'main.Version=${RELEASE_VERSION}'" -o bin/prometheus-aws-discovery-linux-amd64 ./cmd/prometheus-aws-discovery/... | ||
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -ldflags="-X 'main.Version=${RELEASE_VERSION}'" -o bin/prometheus-aws-discovery ./cmd/prometheus-aws-discovery/... | ||
|
||
FROM scratch | ||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ | ||
COPY --from=builder /go/src/github.com/daspawnw/prometheus-aws-discovery/bin/prometheus-aws-discovery-linux-amd64 /prometheus-aws-discovery | ||
COPY --from=builder /go/src/github.com/daspawnw/prometheus-aws-discovery/bin/prometheus-aws-discovery /prometheus-aws-discovery | ||
|
||
ENTRYPOINT ["/prometheus-aws-discovery"] |