Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
FROM golang:1.23-bookworm AS build

WORKDIR /go/src/app
RUN --mount=target=. make build

FROM quay.io/prometheus/busybox:latest

ADD prometheus-example-app /bin/prometheus-example-app
COPY --from=build /tmp/prometheus-example-app /bin/prometheus-example-app

ENTRYPOINT ["/bin/prometheus-example-app"]
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ VERSION:=$(shell cat VERSION)

LDFLAGS="-X main.appVersion=$(VERSION)"

all:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags=$(LDFLAGS) -o prometheus-example-app --installsuffix cgo main.go
build:
CGO_ENABLED=0 go build -ldflags=$(LDFLAGS) -o /tmp/prometheus-example-app --installsuffix cgo main.go

all: build
docker build -t quay.io/brancz/prometheus-example-app:$(VERSION) .

multi: build
docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -t quay.io/brancz/prometheus-example-app:$(VERSION) .