FROM golang:alpine AS build
WORKDIR /app

COPY . .
RUN apk add --no-cache git
RUN go build -ldflags="-X main.version=$(git describe --long) -w -s" -o /app/ntfy-alertmanager


FROM alpine:latest
WORKDIR /

COPY --from=build /app/ntfy-alertmanager /ntfy-alertmanager

RUN apk add --no-cache curl

ENTRYPOINT [ "./ntfy-alertmanager" ]
HEALTHCHECK CMD curl --fail http://localhost:8080/health || exit 1
