stagex/packages/containerd/Containerfile
2024-08-29 12:02:30 -07:00

55 lines
1.6 KiB
Docker

FROM scratch AS base
ENV VERSION=1.7.20
ENV COMMIT=8fc6bcff51318944179630522a095cc9dbf9f353
ENV SRC_FILE=v${VERSION}.tar.gz
ENV SRC_SITE=https://github.com/containerd/containerd/archive/${SRC_FILE}
ENV SRC_HASH=c4268561e514a2e8322bc8cdd39113d5e164fb31c2cef76f479d683395ea9bd6
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/. /