1# 2# Install Qt and Qbs for Linux 3# 4FROM ubuntu:focal 5LABEL Description="Ubuntu development environment for Qbs with Qt and various dependencies for testing Qbs modules and functionality" 6ARG QT_VERSION 7ARG QTCREATOR_VERSION 8 9# Allow colored output on command line. 10ENV TERM=xterm-color 11 12# 13# Make it possible to change UID/GID in the entrypoint script. The docker 14# container usually runs as root user on Linux hosts. When the Docker container 15# mounts a folder on the host and creates files there, those files would be 16# owned by root instead of the current user. Thus we create a user here who's 17# UID will be changed in the entrypoint script to match the UID of the current 18# host user. 19# 20ARG USER_UID=1000 21ARG USER_NAME=devel 22RUN apt-get update -qq && \ 23 apt-get install -qq -y \ 24 ca-certificates \ 25 gosu \ 26 sudo && \ 27 groupadd -g ${USER_UID} ${USER_NAME} && \ 28 useradd -s /bin/bash -u ${USER_UID} -g ${USER_NAME} -o -c "" -m ${USER_NAME} && \ 29 usermod -a -G sudo ${USER_NAME} && \ 30 echo "%devel ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers 31 32COPY docker/focal/entrypoint.sh /sbin/entrypoint.sh 33ENTRYPOINT ["/sbin/entrypoint.sh"] 34 35# Qbs build dependencies 36RUN apt-get update -qq && \ 37 DEBIAN_FRONTEND="noninteractive" apt-get install -qq -y --no-install-recommends \ 38 bison \ 39 build-essential \ 40 ca-certificates \ 41 capnproto \ 42 ccache \ 43 clang-8 \ 44 clang-tidy-8 \ 45 cmake \ 46 curl \ 47 flex \ 48 git \ 49 help2man \ 50 icoutils \ 51 libcapnp-dev \ 52 libdbus-1-3 \ 53 libfreetype6 \ 54 libfontconfig1 \ 55 libgl1-mesa-dev \ 56 libgl1-mesa-glx \ 57 libnanopb-dev \ 58 libprotobuf-dev \ 59 libgrpc++-dev \ 60 libxkbcommon-x11-0 \ 61 nanopb \ 62 ninja-build \ 63 nsis \ 64 pkg-config \ 65 protobuf-compiler \ 66 protobuf-compiler-grpc \ 67 psmisc \ 68 python3-pip \ 69 python3-setuptools \ 70 p7zip-full \ 71 subversion \ 72 unzip \ 73 zip && \ 74 update-alternatives --install /usr/bin/clang clang /usr/bin/clang-8 100 && \ 75 update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-8 100 && \ 76 update-alternatives --install /usr/bin/clang-check clang-check /usr/bin/clang-check-8 100 && \ 77 update-alternatives --install /usr/bin/python python /usr/bin/python3 100 && \ 78 pip install beautifulsoup4 lxml protobuf pyyaml 79 80ENV LLVM_INSTALL_DIR=/usr/lib/llvm-8 81 82 83# 84# Install Qt and Qbs for Linux from qt.io 85# 86COPY scripts/install-qt.sh install-qt.sh 87 88RUN ./install-qt.sh --version ${QT_VERSION} qtbase qtdeclarative qtscript qttools qtx11extras qtscxml qt5compat icu && \ 89 ./install-qt.sh --version ${QTCREATOR_VERSION} qtcreator && \ 90 echo "export PATH=/opt/Qt/${QT_VERSION}/gcc_64/bin:/opt/Qt/Tools/QtCreator/bin:\${PATH}" > /etc/profile.d/qt.sh 91 92ENV PATH=/opt/Qt/${QT_VERSION}/gcc_64/bin:/opt/Qt/Tools/QtCreator/bin:${PATH} 93 94 95# Configure Qbs 96USER $USER_NAME 97RUN qbs-setup-toolchains /usr/bin/g++ gcc && \ 98 qbs-setup-toolchains /usr/bin/clang clang && \ 99 qbs-setup-qt /opt/Qt/${QT_VERSION}/gcc_64/bin/qmake qt-gcc_64 && \ 100 qbs config profiles.qt-gcc_64.baseProfile gcc && \ 101 qbs-setup-qt /opt/Qt/${QT_VERSION}/gcc_64/bin/qmake qt-clang_64 && \ 102 qbs config profiles.qt-clang_64.baseProfile clang && \ 103 qbs config defaultProfile qt-gcc_64 104 105# Switch back to root user for the entrypoint script. 106USER root 107 108# Work-around for QTBUG-79020 109RUN echo "export QT_NO_GLIB=1" >> /etc/profile.d/qt.sh 110