From fbededb1e6a0b0977d87da48f9a8a669317c11d7 Mon Sep 17 00:00:00 2001 From: Sohom Bhattacharjee Date: Mon, 1 Jul 2024 19:37:28 +0530 Subject: [PATCH] add Dockerfile and build target --- Dockerfile | 11 +++++++++++ Makefile | 16 ++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 Dockerfile 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 ./...