-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathDockerfile-ubuntu
38 lines (33 loc) · 1.27 KB
/
Dockerfile-ubuntu
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
FROM ghcr.io/tpm2-software/ubuntu-20.04:latest AS base
FROM base AS rust-toolchain
# Install Rust toolchain
RUN (curl https://sh.rustup.rs -sSf || exit 1) | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
FROM rust-toolchain AS tpm2-tss
# Download and install the TSS library
ENV TPM2_TSS_BINDINGS_VERSION=4.0.1
ARG TPM2_TSS_VERSION=$TPM2_TSS_BINDINGS_VERSION
ENV TPM2_TSS_VERSION=$TPM2_TSS_VERSION
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
RUN git clone https://github.com/tpm2-software/tpm2-tss.git --branch $TPM2_TSS_VERSION
RUN cd tpm2-tss \
&& ./bootstrap \
&& ./configure \
&& make -j$(nproc) \
&& make install \
&& ldconfig
FROM tpm2-tss AS tpm2-tools
# Download and install TPM2 tools
RUN git clone https://github.com/tpm2-software/tpm2-tools.git --branch 5.6
RUN cd tpm2-tools \
&& ./bootstrap \
&& ./configure \
&& make install
FROM tpm2-tools AS tpm2-tss-install-dir
# TPM2_TSS_PATH is the env variable build.rs looks for
# an installation.
ENV TPM2_TSS_PATH=/tpm2-tss-install-dir
RUN mkdir -p /tpm2-tss-install-dir/lib /tpm2-tss-install-dir/include
COPY --from=tpm2-tss tpm2-tss/src/tss2-*/.libs/libtss2-*.so /tpm2-tss-install-dir/lib/
COPY --from=tpm2-tss tpm2-tss/include/ /tpm2-tss-install-dir/include/
COPY --from=tpm2-tss tpm2-tss/VERSION /tpm2-tss-install-dir/