@@ -107,6 +107,16 @@ ENV CGO_ENABLED=1
107107RUN GO=xx-go make static && \
108108 xx-verify --static bypass4netns && cp -a bypass4netns bypass4netnsd /out/${TARGETARCH}
109109
110+ FROM build-base-debian AS build-gomodjail
111+ ARG GOMODJAIL_VERSION
112+ ARG TARGETARCH
113+ RUN git clone --quiet --depth 1 --branch "${GOMODJAIL_VERSION%@*}" https://github.com/AkihiroSuda/gomodjail.git /go/src/github.com/AkihiroSuda/gomodjail
114+ WORKDIR /go/src/github.com/AkihiroSuda/gomodjail
115+ RUN git-checkout-tag-with-hash.sh ${GOMODJAIL_VERSION} && \
116+ mkdir -p /out/${TARGETARCH}
117+ RUN GO=xx-go make STATIC=1 && \
118+ xx-verify --static _output/bin/gomodjail && cp -a _output/bin/gomodjail /out/${TARGETARCH}
119+
110120FROM build-base-debian AS build-kubo
111121ARG KUBO_VERSION
112122ARG TARGETARCH
@@ -234,12 +244,8 @@ RUN ROOTLESSKIT_VERSION=${ROOTLESSKIT_VERSION/@BINARY}; \
234244 rm -f "${fname}" /out/bin/rootlesskit-docker-proxy && \
235245 echo "- RootlessKit: ${ROOTLESSKIT_VERSION}" >> /out/share/doc/nerdctl-full/README.md
236246ARG GOMODJAIL_VERSION
237- RUN git clone https://github.com/AkihiroSuda/gomodjail.git /go/src/github.com/AkihiroSuda/gomodjail && \
238- cd /go/src/github.com/AkihiroSuda/gomodjail && \
239- git-checkout-tag-with-hash.sh "${GOMODJAIL_VERSION}" && \
240- make STATIC=1 && \
241- cp -a _output/bin/gomodjail /out/bin/ && \
242- echo "- gomodjail: ${GOMODJAIL_VERSION}" >> /out/share/doc/nerdctl-full/README.md
247+ COPY --from=build-gomodjail /out/${TARGETARCH:-amd64}/* /out/bin/
248+ RUN echo "- gomodjail: ${GOMODJAIL_VERSION}" >> /out/share/doc/nerdctl-full/README.md
243249
244250RUN echo "" >> /out/share/doc/nerdctl-full/README.md && \
245251 echo "## License" >> /out/share/doc/nerdctl-full/README.md && \
@@ -254,6 +260,8 @@ COPY . /go/src/github.com/containerd/nerdctl
254260RUN { echo "# nerdctl (full distribution)" ; echo "- nerdctl: $(cd /go/src/github.com/containerd/nerdctl && git describe --tags)" ; cat /out/share/doc/nerdctl-full/README.md; } > /out/share/doc/nerdctl-full/README.md.new; mv /out/share/doc/nerdctl-full/README.md.new /out/share/doc/nerdctl-full/README.md
255261WORKDIR /go/src/github.com/containerd/nerdctl
256262RUN BINDIR=/out/bin make binaries install
263+ # FIXME: `gomodjail pack` depends on QEMU for non-native architecture
264+ # TODO: gomodjail should provide a plain shell script that utilizes `zip(1)` for packing the self-extract archive, without running `gomodjail pack`..
257265RUN /out/bin/gomodjail pack --go-mod=/go/src/github.com/containerd/nerdctl/go.mod /out/bin/nerdctl && \
258266 cp -a nerdctl.gomodjail /out/bin/
259267COPY README.md /out/share/doc/nerdctl/
0 commit comments