Enhance ubuntu-26.04-build-container Dockerfile

- Added PIP configuration for internal Nexus repository
- Added Python virtual environment for aqtinstall (best practice)
- Consolidated system library installations
- Improved build script robustness with set -eux
- Better cleanup of temporary directories
- Consistent with other air-gapped Dockerfiles

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Entire-Checkpoint: 01M6PCY7EM7BVBXP7R43E6963E
This commit is contained in:
torstenandCopilot committed 2026-11-05 17:43:37 +00:00
1 parent edd6d01229
commit 733c7b40d1
1 file changed
+173 -138
@@ -1,143 +1,89 @@
# Ubuntu 26.04 Qt6 Build Container
FROM harbor.sl.defence-elec.de/proxydockerhub/library/ubuntu:26.04
LABEL maintainer="Legatus Team"
LABEL description="Qt6 build container for Legatus project"
LABEL version="ubuntu26-qt6.10.2"
# Prevent interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Berlin
ARG RME_USERPASS=ctc
ARG RME_ADMINSRV=10.198.80.75
ARG RME_PROJECT=guez
# Proxy configuration for air-gapped environments
ARG HTTP_PROXY=""
ARG HTTPS_PROXY=""
ARG NO_PROXY="localhost,127.0.0.1,.sl.defence-elec.de"
ARG http_proxy="http://10.198.80.130:3128"
ARG no_proxy="localhost,127.0.0.1,defence-elec.de,.defence-elec.de,sl.defence-elec.de,10.198.80.0/23,192.168.133.0/24,141.200.0.0/16,10.184.0.0/15,10.199.101.35,10.199.101.36,10.199.101.158"
ARG HTTP_PROXY=${http_proxy}
ARG https_proxy=${http_proxy}
ARG HTTPS_PROXY=${http_proxy}
ARG NO_PROXY=${no_proxy}
ENV http_proxy=${HTTP_PROXY}
ENV https_proxy=${HTTPS_PROXY}
ENV no_proxy=${NO_PROXY}
# PIP configuration for internal Nexus repository
ENV PIP_INDEX_URL="http://remote-repo.sl.defence-elec.de:8081/repository/proxypipy/" \
PIP_TRUSTED_HOST="remote-repo.sl.defence-elec.de" \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PYTHONDONTWRITEBYTECODE=1
# Qt6 configuration
ENV QT_VERSION=6.10.2 \
QT_ARCH=linux_gcc_64 \
QT_BASE_DIR=/opt/Qt \
QT_ROOT=/opt/Qt/6.10.2/gcc_64
# OS and PATH configuration
ENV DEBIAN_FRONTEND=noninteractive \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
Qt6_ROOT=${QT_ROOT} \
CMAKE_PREFIX_PATH=/usr/local:${QT_ROOT} \
LD_LIBRARY_PATH=${QT_ROOT}/lib \
PATH=${QT_ROOT}/bin:$PATH
LABEL author="Legatus Team"
LABEL project=${RME_PROJECT}
LABEL version="ubuntu26-qt6.10.2"
LABEL description="Qt6 build container for Legatus project"
# Shell global auf Bash mit sicheren Pipes umstellen
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# Originale Repositories durch Nexus Proxies ersetzen
RUN echo : > /etc/apt/sources.list && \
echo -e "Types: deb\n\
URIs: http://remote-repo.sl.defence-elec.de:8081/repository/ubuntu\n\
Suites: resolute resolute-updates resolute-backports\n\
Components: main restricted universe multiverse\n\
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg\n\
\n\
Types: deb\n\
URIs: http://remote-repo.sl.defence-elec.de:8081/repository/ubuntu-security\n\
Suites: resolute-security\n\
Components: main restricted universe multiverse\n\
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg" > /etc/apt/sources.list.d/ubuntu.sources
# Create users (install openssl first for password hashing)
RUN apt-get update && apt-get install -y openssl \
&& groupadd ctc -g 1445 || true \
&& groupadd rme -g 1001 || true \
&& useradd -d /shd/CTC/TOOLS -u 1445 -g ctc -m -p $(openssl passwd -5 ${RME_USERPASS}) ctc || true \
&& useradd -d /home/rme -u 1001 -g rme -m -p $(openssl passwd -5 ${RME_USERPASS}) rme || true \
&& rm -rf /var/lib/apt/lists/*
RUN curl -fsSL http://${RME_ADMINSRV}/rme/deb_and_rpm_signage_key.pub --output /etc/apt/keyrings/deb_and_rpm_signage_key.asc \
&& curl -fsSL http://${RME_ADMINSRV}/rme/SL-Netz.crt --output /usr/local/share/ca-certificates/SL-Netz.crt \
&& update-ca-certificates
# =============================================================================
# Base Development Tools
# =============================================================================
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
git \
cmake \
ninja-build \
clang \
build-essential \
gnupg \
curl \
jq \
openssh-client \
pkg-config \
git \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# =============================================================================
# Python 3 and aqtinstall for Qt6
# =============================================================================
RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-venv \
python3-pip \
&& rm -rf /var/lib/apt/lists/*
RUN pip3 install --break-system-packages --quiet aqtinstall
# =============================================================================
# Qt6 Framework via aqtinstall
# =============================================================================
ARG QT_VERSION=6.10.2
ARG QT_MODULES="qtmultimedia qtserialport qtimageformats qtwebsockets qtwebengine qtpdf qtwebview qt5compat qtwebchannel qtpositioning qtlocation qtsensors"
RUN aqt install-qt linux desktop ${QT_VERSION} linux_gcc_64 \
-m ${QT_MODULES} \
--outputdir /opt/Qt \
&& ln -sfn /opt/Qt/${QT_VERSION}/gcc_64/bin/* /usr/local/bin/
ENV QT_HOME=/opt/Qt/${QT_VERSION}/gcc_64
ENV PATH=${QT_HOME}/bin:${PATH}
ENV CMAKE_PREFIX_PATH=${QT_HOME}/lib/cmake
# =============================================================================
# Qt6 SVG (not available via aqtinstall - use apt package)
# =============================================================================
RUN apt-get update && apt-get install -y --no-install-recommends \
libqt6svg6-dev \
&& rm -rf /var/lib/apt/lists/*
# =============================================================================
# KDReports 2.3.0
# =============================================================================
ARG KDREPORTS_VERSION=2.3.0
RUN git clone --depth 1 --branch kdreports-${KDREPORTS_VERSION} \
https://github.com/KDAB/KDReports.git /tmp/KDReports \
&& cd /tmp/KDReports \
&& mkdir build && cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_PREFIX_PATH=${QT_HOME} \
-DKDReports_QT6=ON .. \
&& cmake --build . -j$(nproc) \
&& cmake --install . \
&& rm -rf /tmp/KDReports
# Create header alias for legacy includes
RUN ln -sfn /usr/local/include/KDReports-qt6 /usr/local/include/KDReports
# =============================================================================
# Log4Qt 2.0.0
# =============================================================================
ARG LOG4QT_VERSION=2.0.0
RUN git clone --depth 1 --branch v${LOG4QT_VERSION} \
https://github.com/MEONMedical/Log4Qt.git /tmp/Log4Qt \
&& cd /tmp/Log4Qt \
&& mkdir build && cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_PREFIX_PATH=${QT_HOME} .. \
&& cmake --build . -j$(nproc) \
&& cmake --install . \
&& rm -rf /tmp/Log4Qt
# =============================================================================
# Grantlee (Qt6 build from master)
# =============================================================================
RUN git clone --depth 1 https://github.com/steveire/grantlee.git /tmp/grantlee \
&& cd /tmp/grantlee \
&& mkdir build && cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_PREFIX_PATH=${QT_HOME} \
-DGRANTLEE_BUILD_WITH_QT6=ON .. \
&& cmake --build . -j$(nproc) \
&& cmake --install . \
&& rm -rf /tmp/grantlee
# =============================================================================
# GoogleTest
# =============================================================================
RUN apt-get update && apt-get install -y --no-install-recommends \
libgtest-dev \
libgmock-dev \
&& rm -rf /var/lib/apt/lists/*
# =============================================================================
# PostgreSQL 18 Client Libraries
# =============================================================================
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq-dev \
postgresql-server-dev-all \
&& rm -rf /var/lib/apt/lists/*
# =============================================================================
# Additional System Libraries
# =============================================================================
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1-mesa-dev \
libxkbcommon-x11-0 \
libfontconfig1 \
@@ -145,6 +91,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libpulse0 \
libxcb-glx0 \
libxcb-cursor0 \
libpq-dev \
libbz2-dev \
libpoppler-dev \
libpoppler-qt6-dev \
@@ -154,26 +101,114 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
libssl-dev \
libxml2-dev \
libicu-dev \
libkf6texttemplate-dev \
libqt6core6 \
libqt6gui6 \
libqt6widgets6 \
libqt6sql6 \
libqt6sql6-psql \
libqt6test6 \
qt6-base-dev \
qt6-l10n-tools \
qt6-serialport-dev \
qt6-svg-dev \
qt6-tools-dev-tools \
qt6-tools-dev \
qt6-websockets-dev \
libvlc-dev \
vlc-plugin-base \
rpm \
libqt6svg6-dev \
unzip \
python3 \
python3-venv \
python3-pip \
&& ln -sf /usr/bin/python3 /usr/local/bin/python3 \
&& ln -sf /usr/bin/python3 /usr/local/bin/python \
&& rm -rf /var/lib/apt/lists/*
# =============================================================================
# Python 3 Virtual Environment and aqtinstall for Qt6
# =============================================================================
RUN python3 -m venv /opt/venv \
&& /opt/venv/bin/pip install --upgrade pip setuptools wheel \
&& /opt/venv/bin/pip install aqtinstall
# =============================================================================
# Qt6 Framework via aqtinstall
# =============================================================================
RUN set -eux; \
mkdir -p "${QT_BASE_DIR}" \
&& /opt/venv/bin/python -m aqt install-qt linux desktop "${QT_VERSION}" "${QT_ARCH}" \
-m qtmultimedia qtserialport qtimageformats qtwebsockets qtpdf qtwebview qtlocation qtpositioning qt5compat \
--outputdir "${QT_BASE_DIR}" \
&& test -f "${QT_ROOT}/lib/cmake/Qt6/Qt6Config.cmake"
ENV QT_HOME=${QT_ROOT}
ENV PATH=${QT_ROOT}/bin:${PATH}
ENV CMAKE_PREFIX_PATH=${QT_ROOT}/lib/cmake
# =============================================================================
# Qt6 SVG (not available via aqtinstall - use apt package)
# =============================================================================
# Already installed in base dependencies (libqt6svg6-dev)
# =============================================================================
# KDReports 2.3.0
# =============================================================================
ARG KDREPORTS_VERSION=2.3.0
RUN set -eux; \
cd /tmp && \
git clone --depth 1 --branch kdreports-${KDREPORTS_VERSION} \
https://github.com/KDAB/KDReports.git && \
cd KDReports && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_PREFIX_PATH=${QT_ROOT} \
-DKDReports_QT6=ON .. && \
cmake --build . -j$(nproc) && \
cmake --install . && \
cd /tmp && rm -rf KDReports
# Create header alias for legacy includes
RUN ln -sfn /usr/local/include/KDReports-qt6 /usr/local/include/KDReports
# =============================================================================
# Log4Qt 2.0.0
# =============================================================================
ARG LOG4QT_VERSION=2.0.0
RUN set -eux; \
cd /tmp && \
git clone --depth 1 --branch v${LOG4QT_VERSION} \
https://github.com/MEONMedical/Log4Qt.git && \
cd Log4Qt && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_PREFIX_PATH=${QT_ROOT} .. && \
cmake --build . -j$(nproc) && \
cmake --install . && \
cd /tmp && rm -rf Log4Qt
# =============================================================================
# Grantlee (Qt6 build from master)
# =============================================================================
RUN set -eux; \
cd /tmp && \
git clone --depth 1 https://github.com/steveire/grantlee.git && \
cd grantlee && \
mkdir build && cd build && \
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_PREFIX_PATH=${QT_ROOT} \
-DGRANTLEE_BUILD_WITH_QT6=ON .. && \
cmake --build . -j$(nproc) && \
cmake --install . && \
cd /tmp && rm -rf grantlee
# =============================================================================
# GoogleTest
# =============================================================================
RUN apt-get update \
&& apt-get install -y --no-install-recommends libgtest-dev libgmock-dev \
&& rm -rf /var/lib/apt/lists/*
# =============================================================================
# PostgreSQL 18 Client Libraries
# =============================================================================
# Already installed in base dependencies (libpq-dev, postgresql-server-dev-all)
# =============================================================================
# Additional System Libraries
# =============================================================================
# Already installed in base dependencies
# =============================================================================
# Runtime Mount Points for Proprietary Dependencies
# =============================================================================