Skip to content

Commit

Permalink
dockerfile: add delve to binaries-for-test
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max committed Nov 7, 2024
1 parent ff2f852 commit 7b369d8
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ FROM golatest AS gobuild-base
RUN apk add --no-cache file bash clang lld musl-dev pkgconfig git make
COPY --link --from=xx / /

# dlv builds delve for debug variant images
FROM gobuild-base AS dlv
ARG DELVE_VERSION
RUN --mount=target=/root/.cache,type=cache \
--mount=target=/go/pkg/mod,type=cache \
GOBIN=/usr/bin go install github.com/go-delve/delve/cmd/dlv@${DELVE_VERSION}

# runc builds runc binary
FROM gobuild-base AS runc
WORKDIR $GOPATH/src/github.com/opencontainers/runc
Expand Down Expand Up @@ -337,6 +330,23 @@ rmdir "$coverdir/helpers"
exit $ecode
EOF

# dlv builds delve for debug variant images
FROM gobuild-base AS dlv
ARG DELVE_VERSION
ARG TARGETPLATFORM
RUN --mount=target=/root/.cache,type=cache\
--mount=target=/go/pkg/mod,type=cache <<EOT
set -ex
xx-go install "github.com/go-delve/delve/cmd/dlv@${DELVE_VERSION}"
mkdir /out
if ! xx-info is-cross; then
/go/bin/dlv version
mv /go/bin/dlv /out
else
mv /go/bin/*/dlv* /out
fi
EOT

FROM buildkit-export AS buildkit-linux
COPY --link --from=binaries / /usr/bin/
ENV BUILDKIT_SETUP_CGROUPV2_ROOT=1
Expand Down Expand Up @@ -366,6 +376,7 @@ FROM binaries AS buildkit-windows

FROM scratch AS binaries-for-test
COPY --link --from=gotestsum /out /
COPY --link --from=dlv /out /
COPY --link --from=registry /out /
COPY --link --from=containerd /out /
COPY --link --from=binaries / /
Expand Down

0 comments on commit 7b369d8

Please sign in to comment.