From 5e1f849fc2f6714a1112bb5178e1294c4e7d1d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Tue, 22 Oct 2024 12:52:44 +0200 Subject: [PATCH] adjust docker build and co. --- Dockerfile | 4 ++-- Makefile | 8 ++++++++ pkg/template/template.go | 3 +-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index f8faaf7..6fcc39e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ -FROM golang:1.19 AS builder +FROM golang:1.23 AS builder WORKDIR /go/src/github.com/prometheus-community/jiralert COPY . /go/src/github.com/prometheus-community/jiralert RUN GO111MODULE=on GOBIN=/tmp/bin make -FROM quay.io/prometheus/busybox-linux-amd64:latest +FROM gcr.io/distroless/static-debian12:nonroot COPY --from=builder /go/src/github.com/prometheus-community/jiralert/jiralert /bin/jiralert diff --git a/Makefile b/Makefile index 638aea2..ec0cc31 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,12 @@ DOCKER_REPO ?= quay.io/jiralert DOCKER_IMAGE_NAME ?= jiralert +.PHONY: build +build: + go build -ldflags "-w -s" -a -tags netgo -o jiralert ./cmd/jiralert + +.Phone: docker-build +docker-build: + docker buildx build --no-cache --push -t ghcr.io/cloudeteer/jiralert:$$(git rev-parse --short HEAD) --platform linux/arm64,linux/amd64 . + include Makefile.common diff --git a/pkg/template/template.go b/pkg/template/template.go index 648ae7d..82d2514 100644 --- a/pkg/template/template.go +++ b/pkg/template/template.go @@ -23,7 +23,6 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/pkg/errors" - "golang.org/x/text/cases" ) type Template struct { @@ -34,7 +33,7 @@ type Template struct { var funcs = template.FuncMap{ "toUpper": strings.ToUpper, "toLower": strings.ToLower, - "title": cases.Title, + "title": strings.Title, //nolint:staticcheck // TODO(beorn7): Need to come up with a replacement using the cases package. // join is equal to strings.Join but inverts the argument order // for easier pipelining in templates. "join": func(sep string, s []string) string {