Skip to content

Commit

Permalink
Switched to using Alpine Linux (alpine:3.20.2) as the base system to …
Browse files Browse the repository at this point in the history
…minimize image size.
  • Loading branch information
danieltrick committed Aug 28, 2024
1 parent 864a26a commit 898c1d9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/).

## r3 - 2024-08-29

### Changed
- Switched base system from `debian:bookworm-slim` to `alpine:3.20.2`

## r2 - 2024-08-27

### Changed
- swtpm: Updated to revision `54583a87b53623dbb04f9318c68e3d85246a6f9d` (2024-08-27)
- libtpms: Updated to revision `2dc1af12e5b09a7f9eaf2dee47737b63ddfd7cb7` (2024-08-21)
- Switched base from `debian:bookworm` to `debian:bookworm-slim`
- Switched base system from `debian:bookworm` to `debian:bookworm-slim`

## r1 - 2024-08-27

Expand Down
43 changes: 22 additions & 21 deletions Dockerfile
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"]

0 comments on commit 898c1d9

Please sign in to comment.