FROM scratch AS base ENV VERSION=1.7.22 ENV COMMIT=8fc6bcff51318944179630522a095cc9dbf9f353 ENV SRC_FILE=v${VERSION}.tar.gz ENV SRC_SITE=https://github.com/containerd/containerd/archive/${SRC_FILE} ENV SRC_HASH=8c5edde741b7596af63c021429a1212bd616350ed65a7b741eeffc47e27ee9a9 FROM base AS fetch ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} . FROM fetch AS build COPY --from=stagex/musl . / COPY --from=stagex/bash . / COPY --from=stagex/busybox . / COPY --from=stagex/go . / COPY --from=stagex/go-md2man . / COPY --from=stagex/make . / COPY --from=stagex/gcc . / COPY --from=stagex/binutils . / COPY --from=stagex/linux-headers . / COPY --from=stagex/pkgconf . / COPY --from=stagex/libseccomp . / RUN tar -xf ${SRC_FILE} WORKDIR /containerd-${VERSION} ENV GO11MODULE=on RUN <<-EOF set -eux make \ SHIM_CGO_ENABLED=1 \ VERSION=${VERSION} \ REVISION=${COMMIT} \ BUILDMODE=pie \ EXTRA_LDFLAGS="-s -w -buildid=" \ -j "$(nproc)" make man EOF FROM build AS install RUN <<-EOF set -eux rm ./bin/gen-manpages install -d /rootfs/usr/bin/ install -Dsm755 ./bin/* /rootfs/usr/bin/ install -d /rootfs/usr/share/man/man5/ install -Dm644 ./man/*.5 /rootfs/usr/share/man/man5/ install -d /rootfs/usr/share/man/man8/ install -Dm644 ./man/*.8 /rootfs/usr/share/man/man8/ install -d /rootfs/etc/containerd/ /rootfs/usr/bin/containerd config default \ | sed "s|/opt/cni/bin|/usr/libexec/cni|g" \ > /rootfs/etc/containerd/config.toml EOF FROM stagex/filesystem AS package COPY --from=install /rootfs/. /