diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3e93552 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM gcr.io/distroless/base-debian11 + +WORKDIR / + +COPY ./alertmanager ./alertmanager + +EXPOSE 8080 + +USER nonroot:nonroot + +ENTRYPOINT ["./alertmanager"] \ No newline at end of file diff --git a/Makefile b/Makefile index 8401a79..7b04aa9 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,16 @@ -clean: +ALERTMANAGER_VERSION := $(shell ./alertmanager --version | cut -d" " -f3) + +clean: rm alertmanager -build: - go build +build: vet + go build -tags netgo + +docker-build: build + docker build -t alertmanager:$(ALERTMANAGER_VERSION) -f Dockerfile . test: - go test ./... -v \ No newline at end of file + go test ./... -v + +vet: + go vet ./...