Skip to content

Commit

Permalink
fix static build
Browse files Browse the repository at this point in the history
  • Loading branch information
multi-io committed Jan 24, 2024
1 parent 3421c13 commit fba46fe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# git version to check out and build
DLV_VERSION=v1.21.2

TAG=$(DLV_VERSION)
Expand All @@ -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

Expand Down

0 comments on commit fba46fe

Please sign in to comment.