@@ -39,13 +39,6 @@ FROM golatest AS gobuild-base
39
39
RUN apk add --no-cache file bash clang lld musl-dev pkgconfig git make
40
40
COPY --link --from=xx / /
41
41
42
- # dlv builds delve for debug variant images
43
- FROM gobuild-base AS dlv
44
- ARG DELVE_VERSION
45
- RUN --mount=target=/root/.cache,type=cache \
46
- --mount=target=/go/pkg/mod,type=cache \
47
- GOBIN=/usr/bin go install github.com/go-delve/delve/cmd/dlv@${DELVE_VERSION}
48
-
49
42
# runc builds runc binary
50
43
FROM gobuild-base AS runc
51
44
WORKDIR $GOPATH/src/github.com/opencontainers/runc
@@ -337,6 +330,27 @@ rmdir "$coverdir/helpers"
337
330
exit $ecode
338
331
EOF
339
332
333
+ # dlv builds delve for debug variant images
334
+ FROM gobuild-base AS dlv
335
+ ARG DELVE_VERSION
336
+ ARG TARGETPLATFORM
337
+ RUN --mount=target=/root/.cache,type=cache\
338
+ --mount=target=/go/pkg/mod,type=cache <<EOT
339
+ set -ex
340
+ mkdir /out
341
+ if [ "$(xx-info os)" = "freebsd" ]; then
342
+ echo "WARN: dlv requires cgo enabled on FreeBSD, skipping: https://github.com/moby/buildkit/pull/5497#issuecomment-2462031339"
343
+ exit 0
344
+ fi
345
+ xx-go install "github.com/go-delve/delve/cmd/dlv@${DELVE_VERSION}"
346
+ if ! xx-info is-cross; then
347
+ /go/bin/dlv version
348
+ mv /go/bin/dlv /out
349
+ else
350
+ mv /go/bin/*/dlv* /out
351
+ fi
352
+ EOT
353
+
340
354
FROM buildkit-export AS buildkit-linux
341
355
COPY --link --from=binaries / /usr/bin/
342
356
ENV BUILDKIT_SETUP_CGROUPV2_ROOT=1
@@ -366,6 +380,7 @@ FROM binaries AS buildkit-windows
366
380
367
381
FROM scratch AS binaries-for-test
368
382
COPY --link --from=gotestsum /out /
383
+ COPY --link --from=dlv /out /
369
384
COPY --link --from=registry /out /
370
385
COPY --link --from=containerd /out /
371
386
COPY --link --from=binaries / /
0 commit comments