-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
58 lines (47 loc) · 1.65 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
50
51
52
53
54
55
56
57
58
# Debian Version
ARG DEBIAN_VERSION=bookworm-20250113-slim@sha256:f70dc8d6a8b6a06824c92471a1a258030836b26b043881358b967bf73de7c5ab
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Stage #1
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FROM debian:$DEBIAN_VERSION AS build
# MSSIM Version
ARG MSSIM_COMMIT=ee21db0a941decd3cac67925ea3310873af60ab3
# Provide the 'install_packages' helper script
COPY bin/install_packages.sh /usr/sbin/install_packages
# Install build dependencies
RUN install_packages \
autoconf-archive \
automake \
build-essential \
ca-certificates \
curl \
gcc \
git \
libssl-dev \
pkg-config
# Build ms-tpm-20-ref
RUN mkdir -p /tmp/ms-tpm-20-ref/TPMCmd \
&& curl --tlsv1.2 -sSfL https://github.com/microsoft/ms-tpm-20-ref/archive/${MSSIM_COMMIT}.tar.gz | tar -C /tmp/ms-tpm-20-ref --strip-components=1 -xzv \
&& cd /tmp/ms-tpm-20-ref/TPMCmd \
&& ./bootstrap \
&& ./configure --prefix=/opt/mssim \
&& make \
&& make install \
&& cd - \
&& rm -vfr /tmp/ms-tpm-20-ref
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Stage #2
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
FROM debian:$DEBIAN_VERSION
# Provide the 'install_packages' helper script
COPY bin/install_packages.sh /usr/sbin/install_packages
# Install runtime dependencies
RUN install_packages \
libssl3
# Copy the built binaries
COPY --from=build /opt/mssim/bin/tpm2-simulator /usr/bin/
# Copy startup script
COPY bin/entrypoint.sh /opt/
# Start TPM simulator
ENTRYPOINT ["/opt/entrypoint.sh"]
CMD ["2321"]