stagex/packages/tpm2-tools/Containerfile
2024-08-26 11:24:57 -07:00

50 lines
1.4 KiB
Docker

FROM scratch AS base
ENV VERSION=5.6
ENV SRC_HASH=7169fac7b5afb3ce20091b8d66ee13a69cf0b107ea1e17f5d1aa087d99bcf8e2
ENV SRC_FILE=${VERSION}.tar.gz
ENV SRC_SITE=https://github.com/tpm2-software/tpm2-tools/archive/refs/tags/${SRC_FILE}
FROM base AS fetch
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
FROM fetch AS build
COPY --from=stagex/busybox . /
COPY --from=stagex/gcc . /
COPY --from=stagex/binutils . /
COPY --from=stagex/make . /
COPY --from=stagex/musl . /
COPY --from=stagex/linux-headers . /
COPY --from=stagex/util-linux . /
COPY --from=stagex/perl . /
COPY --from=stagex/openssl . /
COPY --from=stagex/autoconf . /
COPY --from=stagex/autoconf-archive . /
COPY --from=stagex/automake . /
COPY --from=stagex/libtool . /
COPY --from=stagex/pkgconf . /
COPY --from=stagex/m4 . /
COPY --from=stagex/curl . /
COPY --from=stagex/tpm2-tss . /
RUN tar -xf ${SRC_FILE}
WORKDIR /tpm2-tools-${VERSION}
RUN --network=none <<-EOF
set -eux
printf "${VERSION}" > VERSION
cat bootstrap | grep -ve ^git > bootstrap-nogit
sh bootstrap-nogit
./configure \
--build=x86_64-unknown-linux-musl \
--host=x86_64-unknown-linux-musl \
--prefix=/usr
make -j "$(nproc)"
EOF
FROM build AS install
RUN --network=none <<-EOF
set -eux
make DESTDIR=/rootfs install
rm -rf /rootfs/var/run
EOF
FROM stagex/filesystem AS package
COPY --from=install /rootfs/. /