Files
rme-jenkins/Dockerfile-ubuntu26-qt6.dockerfile
2026-09-01 12:18:20 +02:00

171 lines
5.7 KiB
Docker

# DOCKERFILE SPEC FOR BUILD Container with Qt6
# Based on Ubuntu 26.04 with aqtinstall for Qt6 installation
FROM ubuntu:26.04
ARG USERPASS=ctc
ARG ADMINSRV=10.198.80.75
ARG PROJECT=guez
ARG REPOVERSION=26.04
ARG QT_VERSION=6.10.2
ARG QT_ARCH=linux_gcc_64
ARG QT_BASE_DIR=/opt/Qt
ARG QT_ROOT=/opt/Qt/6.10.2/gcc_64
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8 \
QT_VERSION=${QT_VERSION} \
QT_ARCH=${QT_ARCH} \
QT_BASE_DIR=${QT_BASE_DIR} \
QT_ROOT=${QT_ROOT} \
Qt6_ROOT=${QT_ROOT} \
CMAKE_PREFIX_PATH=/usr/local:${QT_ROOT} \
LD_LIBRARY_PATH=${QT_ROOT}/lib \
PATH=${QT_ROOT}/bin:$PATH \
ADMINSRV_ENV=${ADMINSRV} \
PROJECT_ENV=${PROJECT} \
REPOVERSION_ENV=${REPOVERSION}
LABEL Author='Thore Poggenburg (updated for Qt6 on Ubuntu 26.04)'
LABEL PROJECT=${PROJECT}
LABEL OS_VERSION=${REPOVERSION}
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# 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 ${USERPASS}) ctc || true \
&& useradd -d /home/rme -u 1001 -g rme -m -p $(openssl passwd -5 ${USERPASS}) rme || true \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install base development tools and Qt6 dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
sudo \
git \
cmake \
ninja-build \
clang \
build-essential \
gnupg \
curl \
jq \
openssh-client \
pkg-config \
libgl1-mesa-dev \
libxkbcommon-x11-0 \
libfontconfig1 \
libdbus-1-3 \
libpulse0 \
libxcb-glx0 \
libxcb-cursor0 \
libpq-dev \
libbz2-dev \
libpoppler-dev \
libpoppler-qt6-dev \
libboost-dev \
libgeographiclib-dev \
libbotan-3-dev \
libssl-dev \
libxml2-dev \
libicu-dev \
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/*
# Setup Python virtual environment and install aqtinstall
RUN python3 -m venv /opt/venv \
&& /opt/venv/bin/pip install --upgrade pip setuptools wheel \
&& /opt/venv/bin/pip install aqtinstall
# Install Qt6 via aqtinstall with required modules
# Note: Qt6Location requires Qt6Positioning as dependency
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"
# ArcGIS Maps SDK for Qt will be mounted at runtime if needed:
# docker run -v /path/to/ArcGIS:/opt/ArcGIS ...
# Set ARCGIS_SDK_ROOT for discovery (will be used if mounted)
ENV ARCGIS_SDK_ROOT=/opt/ArcGIS/MapsSDK_Qt_300.0.0
# Build and install Log4Qt from source (Qt6 support)
RUN set -eux; \
cd /tmp && \
git clone --depth 1 --branch v2.0.0 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
# Build and install Grantlee from source (Qt6 support)
# Note: Ubuntu grantlee5-devel is Qt5-based, so we build Qt6-compatible version from master branch
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
# Build and install KDReports from source (Qt6 support)
RUN set -eux; \
cd /tmp && \
git clone --depth 1 --branch kdreports-2.3.0 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
# Install GoogleTest
RUN apt-get update \
&& apt-get install -y --no-install-recommends libgtest-dev libgmock-dev \
&& rm -rf /var/lib/apt/lists/*
# Add RPM/rpmbuild tools for make_rpm.py
# Note: Ubuntu uses different package names than openSUSE/Fedora
# - rpm: provides rpmbuild command and basic infrastructure
# - rpmdevtools is NOT available on Ubuntu, we create directory structure manually
RUN apt-get update \
&& apt-get install -y --no-install-recommends rpm \
&& rm -rf /var/lib/apt/lists/*
# Setup rpmbuild directory structure (normally done by rpmdev-setuptree on Fedora/openSUSE)
RUN mkdir -p /shd/CTC/TOOLS/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} \
&& chown -R ctc:ctc /shd/CTC/TOOLS/rpmbuild
# RTI Connext DDS (proprietary) should be mounted at runtime:
# docker run -v /path/to/rti:/opt/RTI ...
# Set DDS_PATH for RTI discovery (will be used if RTI is mounted)
ENV DDS_PATH=/opt/RTI
# Cleanup
RUN apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
USER ctc
WORKDIR /shd/CTC/TOOLS
CMD ["/bin/bash"]