| 1 |
FROM python:3.9-alpine3.19 AS builder |
| 2 |
|
| 3 |
LABEL org.opencontainers.image.authors="Stefan Berger" |
| 4 |
|
| 5 |
ENV PACKAGES="curl openssl-dev automake autoconf bash build-base libtool make socat gawk libtasn1-dev gnutls gnutls-utils gnutls-dev expect libseccomp-dev softhsm py3-cryptography py3-twisted py3-setuptools json-glib-dev gmp-dev" |
| 6 |
RUN apk add --no-cache --no-check-certificate $PACKAGES && rm -rf /var/cache/apk/* |
| 7 |
|
| 8 |
ARG LIBTPMS_BRANCH=master |
| 9 |
WORKDIR /src/build-prep/libtpms |
| 10 |
SHELL ["/bin/bash", "-o", "pipefail", "-c"] |
| 11 |
|
| 12 |
RUN curl -kL "https://github.com/stefanberger/libtpms/archive/${LIBTPMS_BRANCH}.tar.gz" \ |
| 13 |
| tar --strip=1 -zxvf - -C /src/build-prep/libtpms |
| 14 |
|
| 15 |
RUN ./autogen.sh --prefix=/usr --libdir=/usr/lib --with-tpm2 --with-openssl \ |
| 16 |
&& make -j"$(nproc)" V=1 \ |
| 17 |
&& make -j"$(nproc)" V=1 check \ |
| 18 |
&& make -j"$(nproc)" install \ |
| 19 |
&& make DESTDIR=/app -j"$(nproc)" install |
| 20 |
|
| 21 |
COPY . /src/build-prep/swtpm |
| 22 |
WORKDIR /src/build-prep/swtpm |
| 23 |
SHELL ["/bin/bash", "-o", "pipefail", "-c"] |
| 24 |
|
| 25 |
RUN ./autogen.sh --prefix=/usr --libdir=/usr/lib --with-openssl --with-tss-user=root --with-tss-group=root \ |
| 26 |
&& make -j"$(nproc)" V=1 \ |
| 27 |
&& echo "softhsm or certtool are crashing pkcs11 test case" \ |
| 28 |
&& { for f in test_tpm2_swtpm_localca_pkcs11.test test_tpm2_samples_swtpm_localca_pkcs11; do echo -en '#!/usr/bin/env bash'"\nexit 77\n" > tests/${f}; done; } \ |
| 29 |
&& make -j"$(nproc)" V=1 VERBOSE=1 check \ |
| 30 |
&& make DESTDIR=/app -j"$(nproc)" install |
| 31 |
|
| 32 |
FROM alpine:3.19 |
| 33 |
|
| 34 |
LABEL org.opencontainers.image.authors="Stefan Berger" |
| 35 |
|
| 36 |
ENV PACKAGES="openssl socat gawk libtasn1 expect libseccomp softhsm py3-cryptography py3-twisted py3-setuptools json-glib gmp" |
| 37 |
RUN apk add --no-cache --no-check-certificate $PACKAGES && rm -rf /var/cache/apk/* |
| 38 |
|
| 39 |
COPY --from=builder /app / |
| 40 |
|
| 41 |
WORKDIR /app |
| 42 |
|
| 43 |
ENTRYPOINT ["/usr/bin/swtpm"] |