diff --git a/Dockerfile b/Dockerfile index 2a51402..5a841f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,8 @@ FROM golang:1.21.2 AS builder -RUN git clone https://github.com/go-delve/delve.git /go/src/github.com/go-delve/delve && \ - cd /go/src/github.com/go-delve/delve && \ - git checkout ${DLV_VERSION} && \ - go install -ldflags "-X main.Build=$(git rev-parse HEAD) -extldflags \"-fno-PIC -static\"" -buildmode pie -tags 'osusergo netgo static_build' github.com/go-delve/delve/cmd/dlv +ARG DLV_VERSION +RUN CGO_ENABLED=0 go install -ldflags "-w -extldflags '-static'" github.com/go-delve/delve/cmd/dlv@${DLV_VERSION} FROM alpine:latest AS minimal diff --git a/Makefile b/Makefile index 1138d88..4c62a78 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,3 @@ -# git version to check out and build DLV_VERSION=v1.21.2 TAG=$(DLV_VERSION) @@ -7,10 +6,10 @@ MIN_IMAGE=oklischat/delve:$(TAG) SUMO_IMAGE=oklischat/delve-sumo:$(TAG) build-min: - docker build --target minimal --build-arg DLV_VERSION --tag $(MIN_IMAGE) . + docker build --target minimal --build-arg DLV_VERSION=$(DLV_VERSION) --tag $(MIN_IMAGE) . build-sumo: - docker build --target sumo --build-arg DLV_VERSION --tag $(SUMO_IMAGE) . + docker build --target sumo --build-arg DLV_VERSION=$(DLV_VERSION) --tag $(SUMO_IMAGE) . build-all: build-min build-sumo