From 3818578644cda8d4a3e348c1b2486f4a85943a37 Mon Sep 17 00:00:00 2001 From: "Lance R. Vick" Date: Mon, 2 Sep 2024 14:51:38 -0700 Subject: [PATCH] feat: package swtpm --- packages/swtpm | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 packages/swtpm diff --git a/packages/swtpm b/packages/swtpm new file mode 100644 index 0000000..94f2f04 --- /dev/null +++ b/packages/swtpm @@ -0,0 +1,43 @@ +FROM scratch AS base +ARG ARCH=x86_64 +ENV VERSION=0.9.0 +ENV SRC_HASH=9679ca171e8aaa3c4e4053e8bc1d10c8dabf0220bd4b16aba78743511c25f731 +ENV SRC_FILE=v${VERSION}.tar.gz +ENV SRC_SITE=https://github.com/stefanberger/swtpm/archive/${SRC_FILE} + +FROM base AS fetch +ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} . + +FROM fetch AS build +COPY --from=stagex/busybox . / +COPY --from=stagex/binutils . / +COPY --from=stagex/musl . / +COPY --from=stagex/make . / +COPY --from=stagex/gcc . / +COPY --from=stagex/m4 . / +COPY --from=stagex/perl . / +COPY --from=stagex/autoconf . / +COPY --from=stagex/automake . / +COPY --from=stagex/libtool . / +COPY --from=stagex/openssl . / +RUN tar -xf ${SRC_FILE} +WORKDIR /xz-${VERSION} +RUN --network=none <<-EOF + set -ex + NOCONFIGURE=1 ./autogen.sh + ./configure \ + --build=${ARCH}-linux-musl \ + --host=${ARCH}-linux-musl \ + --prefix=/usr \ + --libdir=/usr/lib \ + --with-openssl \ + --with-tss-user=root \ + --with-tss-group=root + make -j "$(nproc)" +EOF + +FROM build AS install +RUN --network=none make DESTDIR="/rootfs" install + +FROM stagex/filesystem AS package +COPY --from=install /rootfs/. /