diff --git a/Dockerfile b/Dockerfile index fdfee62..96ed548 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Base -FROM golang:1.20.5-alpine AS builder +FROM golang:1.21.4-alpine AS builder RUN apk add --no-cache build-base WORKDIR /app COPY . /app @@ -7,7 +7,7 @@ RUN go mod download RUN go build ./cmd/notify # Release -FROM alpine:3.18.3 +FROM alpine:3.18.2 RUN apk -U upgrade --no-cache \ && apk add --no-cache bind-tools ca-certificates COPY --from=builder /app/notify /usr/local/bin/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..a47cde8 --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +# Go parameters +GOCMD=go +GOBUILD=$(GOCMD) build +GOMOD=$(GOCMD) mod +GOTEST=$(GOCMD) test +GOFLAGS := -v +# This should be disabled if the binary uses pprof +LDFLAGS := -s -w + +ifneq ($(shell go env GOOS),darwin) +LDFLAGS := -extldflags "-static" +endif + +all: build +build: + $(GOBUILD) $(GOFLAGS) -ldflags '$(LDFLAGS)' -o "notify" cmd/notify/notify.go +test: + $(GOTEST) $(GOFLAGS) ./... +tidy: + $(GOMOD) tidy \ No newline at end of file