-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
49 lines (40 loc) · 1.69 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
44
45
46
47
48
49
FROM alpine:latest as tpm2-build
RUN apk update && apk upgrade && \
apk add --update alpine-sdk \
curl-dev \
openssl-dev && \
rm -rf /var/cache/apk/*
WORKDIR /build
RUN wget https://downloads.sourceforge.net/project/ibmswtpm2/ibmtpm1119.tar.gz && \
tar -xzf ibmtpm1119.tar.gz && \
make -C src -j$(nproc)
COPY 001-tpm2-tss-select.patch .
RUN wget https://github.com/tpm2-software/tpm2-tss/releases/download/1.3.0/tpm2-tss-1.3.0.tar.gz && \
tar -xzf tpm2-tss-1.3.0.tar.gz && \
cd tpm2-tss-1.3.0 && \
patch -p1 < ../001-tpm2-tss-select.patch && \
./configure && \
make -j$(nproc) && make install
RUN wget https://github.com/tpm2-software/tpm2-tools/releases/download/3.0.3/tpm2-tools-3.0.3.tar.gz && \
tar -xzf tpm2-tools-3.0.3.tar.gz && \
cd tpm2-tools-3.0.3 && \
./configure --disable-hardening --disable-unit --without-tcti-device --without-tcti-tabrmd && \
make -j$(nproc) && make install
# The final image running only the simulator
FROM alpine:latest
LABEL maintainer="[email protected]"
LABEL description="TPM2 Simulator"
RUN apk update && apk upgrade && \
apk add --update libssl1.0 && \
rm -rf /var/cache/apk/*
WORKDIR /tpm2/
COPY --from=tpm2-build /build/src/tpm_server /bin
COPY --from=tpm2-build /usr/local/lib/libtcti-socket.so.0.0.0 /usr/local/lib/libsapi.so.0.0.0 /usr/local/lib/
RUN ln -s /usr/local/lib/libsapi.so.0.0.0 /usr/lib/libsapi.so && \
ln -s /usr/local/lib/libsapi.so.0.0.0 /usr/lib/libsapi.so.0 && \
ln -s /usr/local/lib/libtcti-socket.so.0.0.0 /usr/lib/libtcti-socket.so && \
ln -s /usr/local/lib/libtcti-socket.so.0.0.0 /usr/lib/libtcti-socket.so.0
COPY --from=tpm2-build /usr/local/bin/tpm* /usr/bin/
EXPOSE 2321
EXPOSE 2322
CMD [ "tpm_server" ]