22
33# Do not update runc to v1.2.x until https://github.com/opencontainers/runc/issues/4518 is resolved
44ARG RUNC_VERSION=v1.1.15
5- ARG CONTAINERD_VERSION=v1.7.23
6- # CONTAINERD_ALT_VERSION_16 defines fallback containerd version for integration tests
5+ ARG CONTAINERD_VERSION=v2.0.0
6+ # CONTAINERD_ALT_VERSION_... defines fallback containerd version for integration tests
7+ ARG CONTAINERD_ALT_VERSION_17=v1.7.23
78ARG CONTAINERD_ALT_VERSION_16=v1.6.36
89ARG REGISTRY_VERSION=v2.8.3
910ARG ROOTLESSKIT_VERSION=v2.3.1
@@ -207,54 +208,52 @@ RUN apk add --no-cache fuse3 git openssh pigz xz iptables ip6tables \
207208COPY --link examples/buildctl-daemonless/buildctl-daemonless.sh /usr/bin/
208209VOLUME /var/lib/buildkit
209210
210- FROM gobuild-base AS containerd
211+ FROM gobuild-base AS containerd-build
211212WORKDIR /go/src/github.com/containerd/containerd
212- ARG CONTAINERD_VERSION
213- ADD --keep-git-dir=true "https://github.com/containerd/containerd.git#$CONTAINERD_VERSION" .
214213ARG TARGETPLATFORM
215214ENV CGO_ENABLED=1 BUILDTAGS=no_btrfs GO111MODULE=off
216215RUN xx-apk add musl-dev gcc && xx-go --wrap
217- RUN --mount=target=/root/.cache,type=cache <<EOT
218- set -ex
219- mkdir /out
220- ext=""
216+ COPY --chmod=755 <<-EOT /build.sh
217+ # !/bin/sh
218+ set -ex
219+ mkdir /out
220+ if [ "$(xx-info os)" = "linux" ]; then
221+ make bin/containerd
222+ make bin/containerd-shim-runc-v2
223+ mv bin/containerd bin/containerd-shim* /out
224+ else
225+ CGO_ENABLED=0 make STATIC=1 binaries
221226 if [ "$(xx-info os)" = "windows" ]; then
222- ext=".exe"
223- fi
224- if [ "$(xx-info os)" = "linux" ]; then
225- make bin/containerd
226- make bin/containerd-shim-runc-v2
227- mv bin/containerd bin/containerd-shim* /out
227+ mv bin/containerd.exe /out
228228 else
229- CGO_ENABLED=0 make STATIC=1 binaries
230- mv bin/containerd${ext} bin/containerd-shim* /out
229+ mv bin/containerd /out
230+ fi
231+ # No shim binary is built for FreeBSD, since containerd v2.0.
232+ if ls bin/containerd-shim* >/dev/null 2>&1; then
233+ mv bin/containerd-shim* /out
231234 fi
235+ fi
232236EOT
233237
238+ FROM containerd-build AS containerd
239+ WORKDIR /go/src/github.com/containerd/containerd
240+ ARG CONTAINERD_VERSION
241+ ADD --keep-git-dir=true "https://github.com/containerd/containerd.git#$CONTAINERD_VERSION" .
242+ RUN /build.sh
243+
244+ # containerd-alt-17 builds containerd v1.7 for integration tests
245+ FROM containerd-build AS containerd-alt-17
246+ WORKDIR /go/src/github.com/containerd/containerd
247+ ARG CONTAINERD_ALT_VERSION_17
248+ ADD --keep-git-dir=true "https://github.com/containerd/containerd.git#$CONTAINERD_ALT_VERSION_17" .
249+ RUN /build.sh
250+
234251# containerd-alt-16 builds containerd v1.6 for integration tests
235- FROM gobuild-base AS containerd-alt-16
252+ FROM containerd-build AS containerd-alt-16
236253WORKDIR /go/src/github.com/containerd/containerd
237254ARG CONTAINERD_ALT_VERSION_16
238255ADD --keep-git-dir=true "https://github.com/containerd/containerd.git#$CONTAINERD_ALT_VERSION_16" .
239- ARG TARGETPLATFORM
240- ENV CGO_ENABLED=1 BUILDTAGS=no_btrfs GO111MODULE=off
241- RUN xx-apk add musl-dev gcc && xx-go --wrap
242- RUN --mount=target=/root/.cache,type=cache <<EOT
243- set -ex
244- mkdir /out
245- ext=""
246- if [ "$(xx-info os)" = "windows" ]; then
247- ext=".exe"
248- fi
249- if [ "$(xx-info os)" = "linux" ]; then
250- make bin/containerd
251- make bin/containerd-shim-runc-v2
252- mv bin/containerd bin/containerd-shim* /out
253- else
254- CGO_ENABLED=0 make STATIC=1 binaries
255- mv bin/containerd${ext} bin/containerd-shim* /out
256- fi
257- EOT
256+ RUN /build.sh
258257
259258FROM gobuild-base AS registry
260259WORKDIR /go/src/github.com/docker/distribution
@@ -391,7 +390,7 @@ RUN curl -Ls https://raw.githubusercontent.com/moby/moby/v25.0.1/hack/dind > /do
391390 && chmod 0755 /docker-entrypoint.sh
392391ENTRYPOINT ["/docker-entrypoint.sh" ]
393392# musl is needed to directly use the registry binary that is built on alpine
394- ENV BUILDKIT_INTEGRATION_CONTAINERD_EXTRA="containerd-1.6=/opt/containerd-alt-16/bin"
393+ ENV BUILDKIT_INTEGRATION_CONTAINERD_EXTRA="containerd-1.7=/opt/containerd-alt-17/bin,containerd-1. 6=/opt/containerd-alt-16/bin"
395394ENV BUILDKIT_INTEGRATION_SNAPSHOTTER=stargz
396395ENV BUILDKIT_SETUP_CGROUPV2_ROOT=1
397396ENV CGO_ENABLED=0
@@ -402,6 +401,7 @@ COPY --link --from=minio-mc /usr/bin/mc /usr/bin/
402401COPY --link --from=nydus /out/nydus-static/* /usr/bin/
403402COPY --link --from=stargz-snapshotter /out/* /usr/bin/
404403COPY --link --from=rootlesskit /rootlesskit /usr/bin/
404+ COPY --link --from=containerd-alt-17 /out/containerd* /opt/containerd-alt-17/bin/
405405COPY --link --from=containerd-alt-16 /out/containerd* /opt/containerd-alt-16/bin/
406406COPY --link --from=registry /out /usr/bin/
407407COPY --link --from=runc /usr/bin/runc /usr/bin/
0 commit comments