# ==============================================================================
#  Build-container image for the qt-course repo.
#
#  Usage model (see docker_install_qt.sh / docker_build.sh / docker_run_qt.sh):
#    1. Install isolated Qt 5.14.2 INTO THE REPO at .qt514/  (one-off, ~577MB).
#       The Qt files live on the host filesystem, mounted into the container.
#    2. Build the Qt part from a container, writing into the mounted build/.
#    3. RUN the compiled Qt apps on the HOST (no container needed) using
#       LD_LIBRARY_PATH=.qt514/.../lib — host & container share glibc 2.39,
#       so binaries built in the container run natively on the host. Isolation
#       from the system Qt 5.15 is by prefix + LD_LIBRARY_PATH, not by the
#       container boundary.
#
#  This image only needs the build toolchain + aqtinstall. It is small and
#  stable (no multi-GB Qt layer baked in; Qt is downloaded into the mount).
# ------------------------------------------------------------------------------
FROM ubuntu:24.04

ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Asia/Shanghai

# Build toolchain matching the host (gcc 13.3, cmake 3.28, ninja) + runtime
# libs so the container can also run GUI examples with X11 forwarding if needed.
RUN apt-get update && apt-get install -y --no-install-recommends \
        build-essential g++ gcc cmake ninja-build git \
        ca-certificates python3 python3-pip python3-venv \
        libgl1 libegl1 libxkbcommon0 libdbus-1-3 \
        libfontconfig1 libfreetype6 libxcb-cursor0 \
        fontconfig xauth x11-xserver-utils \
    && rm -rf /var/lib/apt/lists/*

RUN pip3 install --break-system-packages aqtinstall

WORKDIR /workspace
