Skip to content

Commit 09a9f3a

Browse files
committed
dockerfile: use xx in dnsname stage
Signed-off-by: CrazyMax <[email protected]>
1 parent 40866f3 commit 09a9f3a

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

Dockerfile

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,6 @@ RUN --mount=from=runc-src,src=/usr/src/runc,target=. --mount=target=/root/.cache
6767
CGO_ENABLED=1 xx-go build -mod=vendor -ldflags '-extldflags -static' -tags 'apparmor seccomp netgo cgo static_build osusergo' -o /usr/bin/runc ./ && \
6868
xx-verify --static /usr/bin/runc
6969

70-
# dnsname CNI plugin for testing
71-
FROM gobuild-base AS dnsname
72-
ARG DNSNAME_VERSION
73-
WORKDIR /go/dnsname
74-
RUN git clone https://github.com/containers/dnsname.git . \
75-
&& git checkout -q "$DNSNAME_VERSION"
76-
RUN --mount=target=/root/.cache,type=cache \
77-
set -e; make binaries; mv bin/dnsname /usr/bin/dnsname
78-
7970
FROM gobuild-base AS buildkit-base
8071
WORKDIR /src
8172
ENV GOFLAGS=-mod=vendor
@@ -225,6 +216,22 @@ FROM binaries AS buildkit-windows
225216
# this is not in binaries-windows because it is not intended for release yet, just CI
226217
COPY --link --from=buildkitd /usr/bin/buildkitd /buildkitd.exe
227218

219+
# dnsname source
220+
FROM git AS dnsname-src
221+
ARG DNSNAME_VERSION
222+
WORKDIR /usr/src
223+
RUN git clone https://github.com/containers/dnsname.git dnsname \
224+
&& cd dnsname && git checkout -q "$DNSNAME_VERSION"
225+
226+
# build dnsname CNI plugin for testing
227+
FROM gobuild-base AS dnsname
228+
WORKDIR /go/src/github.com/containers/dnsname
229+
ARG TARGETPLATFORM
230+
RUN --mount=from=dnsname-src,src=/usr/src/dnsname,target=.,rw \
231+
--mount=target=/root/.cache,type=cache \
232+
CGO_ENABLED=0 xx-go build -o /usr/bin/dnsname ./plugins/meta/dnsname && \
233+
xx-verify --static /usr/bin/dnsname
234+
228235
FROM --platform=$BUILDPLATFORM alpine:${ALPINE_VERSION} AS cni-plugins
229236
RUN apk add --no-cache curl
230237
ARG CNI_VERSION

0 commit comments

Comments
 (0)