FROM ubuntu:24.04

# Install OpenSSL CLI and Python with the pyca cryptography library.
# These are the tools used in Lab 4.2 (TLS handshake inspection, key generation,
# AEAD encryption) as described in Section 4.11 of the chapter.
RUN apt-get update && apt-get install -y --no-install-recommends \
    openssl \
    python3 \
    python3-pip \
    python3-venv \
    ca-certificates \
    curl \
    && rm -rf /var/lib/apt/lists/*

# Install Python packages into a venv to avoid the PEP 668 externally-managed error
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"

RUN pip install --no-cache-dir cryptography==42.0.8 requests==2.32.3

WORKDIR /lab
COPY lab4_2_demo.py .

# Keep alive for interactive exec
CMD ["tail", "-f", "/dev/null"]
