84c4c45d5b
Embedding the version file is slightly annoying for packaging, because the release tarball is not a git repository and so "go generate" would fail. Instead a packager would have to manually create the version.txt file. With using a linker flag, the version string has a graceful fallback.
14 lines
297 B
Text
14 lines
297 B
Text
FROM golang:alpine as build
|
|
WORKDIR /app
|
|
|
|
COPY . .
|
|
RUN apk add --no-cache git
|
|
RUN go build -ldflags="-X main.version=$(git describe --long)" -o /app/ntfy-alertmanager
|
|
|
|
|
|
FROM alpine:latest
|
|
WORKDIR /
|
|
|
|
COPY --from=build /app/ntfy-alertmanager /ntfy-alertmanager
|
|
|
|
ENTRYPOINT [ "./ntfy-alertmanager" ]
|