-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switched to using Alpine Linux (alpine:3.20.2) as the base system to …
…minimize image size.
- Loading branch information
1 parent
864a26a
commit 898c1d9
Showing
2 changed files
with
28 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,46 @@ | ||
# Docker file for SWTPM | ||
FROM debian:bookworm-slim | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
FROM alpine:3.20.2 | ||
|
||
# Versions | ||
ARG LTPMS_COMMIT=2dc1af12e5b09a7f9eaf2dee47737b63ddfd7cb7 | ||
ARG SWTPM_COMMIT=54583a87b53623dbb04f9318c68e3d85246a6f9d | ||
|
||
# Install libtpms and swtpm dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
# Install required dependencies | ||
RUN apk add --no-cache \ | ||
autoconf \ | ||
build-essential \ | ||
automake \ | ||
bash \ | ||
build-base \ | ||
curl \ | ||
libgmp-dev \ | ||
libjson-glib-dev \ | ||
gmp-dev \ | ||
gnutls-dev \ | ||
json-glib-dev \ | ||
libseccomp-dev \ | ||
libssl-dev \ | ||
libtasn1-6-dev \ | ||
libtasn1-dev \ | ||
libtool \ | ||
pkg-config | ||
make \ | ||
openssl-dev | ||
|
||
# Build libtpms | ||
RUN mkdir -p /tmp/libtpms-src \ | ||
&& curl --tlsv1.2 -sSfL https://github.com/stefanberger/libtpms/archive/${LTPMS_COMMIT}.tar.gz | tar -C /tmp/libtpms-src --strip-components=1 -xzv \ | ||
&& cd /tmp/libtpms-src \ | ||
&& ./autogen.sh --prefix=/opt/swtpm $LIBTPMS_AUTOGEN_EXTRA --with-openssl --with-tpm2 --disable-tests \ | ||
&& ./autogen.sh --prefix=/usr --libdir=/usr/lib --with-tpm2 --with-openssl --disable-tests \ | ||
&& make -j$(nproc) \ | ||
&& make install \ | ||
&& cd ~ \ | ||
&& make -j$(nproc) install \ | ||
&& cd - \ | ||
&& rm -vfr /tmp/libtpms-src | ||
|
||
# Build SWTPM | ||
RUN mkdir -p /tmp/swtpm-src \ | ||
&& curl --tlsv1.2 -sSfL https://github.com/stefanberger/swtpm/archive/${SWTPM_COMMIT}.tar.gz | tar -C /tmp/swtpm-src --strip-components=1 -xzv \ | ||
&& cd /tmp/swtpm-src \ | ||
&& PKG_CONFIG_PATH=/opt/swtpm/lib/pkgconfig ./autogen.sh --prefix=/opt/swtpm --libdir=/opt/swtpm/lib --disable-tests \ | ||
&& make -j$(nproc) $SWTPM_MAKE_EXTRA \ | ||
&& make install \ | ||
&& cd ~ \ | ||
&& ./autogen.sh --prefix=/usr --libdir=/usr/lib --with-openssl --disable-tests \ | ||
&& make -j$(nproc) \ | ||
&& make -j$(nproc) install \ | ||
&& cd - \ | ||
&& rm -vfr /tmp/swtpm-src | ||
|
||
# Start SWTPM Server | ||
ENTRYPOINT ["/opt/swtpm/bin/swtpm"] | ||
CMD ["socket", "--tpm2", "--server", "port=2321,bindaddr=0.0.0.0,disconnect", "--ctrl", "type=tcp,port=2322,bindaddr=0.0.0.0", "--flags", "not-need-init"] | ||
ENTRYPOINT ["/usr/bin/swtpm"] | ||
CMD ["socket", "--tpm2", "--server", "port=2321,bindaddr=0.0.0.0", "--ctrl", "type=tcp,port=2322,bindaddr=0.0.0.0"] |