Source
FROM stagex/pallet-cgo AS build
ARG VERSION
COPY --from=stagex/user-libseccomp . /
COPY --from=stagex/user-go-md2man . /
ADD fetch/containerd-${VERSION}.tar.gz .
WORKDIR /containerd-${VERSION}
ENV GO11MODULE=on
RUN <<-EOF
set -eux
make \
SHIM_CGO_ENABLED=1 \
VERSION=${VERSION} \
REVISION=${VERSION} \
BUILDMODE=pie \
EXTRA_LDFLAGS="-s -w -buildid=" \
-j "$(nproc)"
make man
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/core-filesystem AS package
COPY --from=build /rootfs/ /