-
Notifications
You must be signed in to change notification settings - Fork 146
/
Copy pathDockerfile
43 lines (30 loc) · 1.77 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
FROM python:3.9-alpine3.19 AS builder
LABEL org.opencontainers.image.authors="Stefan Berger"
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"
RUN apk add --no-cache --no-check-certificate $PACKAGES && rm -rf /var/cache/apk/*
ARG LIBTPMS_BRANCH=master
WORKDIR /src/build-prep/libtpms
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN curl -kL "https://github.com/stefanberger/libtpms/archive/${LIBTPMS_BRANCH}.tar.gz" \
| tar --strip=1 -zxvf - -C /src/build-prep/libtpms
RUN ./autogen.sh --prefix=/usr --libdir=/usr/lib --with-tpm2 --with-openssl \
&& make -j"$(nproc)" V=1 \
&& make -j"$(nproc)" V=1 check \
&& make -j"$(nproc)" install \
&& make DESTDIR=/app -j"$(nproc)" install
COPY . /src/build-prep/swtpm
WORKDIR /src/build-prep/swtpm
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN ./autogen.sh --prefix=/usr --libdir=/usr/lib --with-openssl --with-tss-user=root --with-tss-group=root \
&& make -j"$(nproc)" V=1 \
&& echo "softhsm or certtool are crashing pkcs11 test case" \
&& { 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; } \
&& make -j"$(nproc)" V=1 VERBOSE=1 check \
&& make DESTDIR=/app -j"$(nproc)" install
FROM alpine:3.19
LABEL org.opencontainers.image.authors="Stefan Berger"
ENV PACKAGES="openssl socat gawk libtasn1 expect libseccomp softhsm py3-cryptography py3-twisted py3-setuptools json-glib gmp"
RUN apk add --no-cache --no-check-certificate $PACKAGES && rm -rf /var/cache/apk/*
COPY --from=builder /app /
WORKDIR /app
ENTRYPOINT ["/usr/bin/swtpm"]