From 0d52ce22a9bf1d19a4c5590dd17f7f80abb3b6aa Mon Sep 17 00:00:00 2001 From: Richard Weickelt Date: Thu, 15 Aug 2019 07:22:02 +0200 Subject: Switch to Qt installer script in Docker container MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the official packages instead of compiling Qt ourselves. This simplifies the Docker image a lot. For accessing the script folder, the Docker context needs to change to the root directory. Thus, we need a .dockerignore file to keep the size of the context low. Change-Id: I58ec8f364feba955518f1eaf5bff234332ae8dec Reviewed-by: Jörg Bornemann --- docker/stretch/Dockerfile | 165 ++++++++-------------------------------------- 1 file changed, 27 insertions(+), 138 deletions(-) (limited to 'docker') diff --git a/docker/stretch/Dockerfile b/docker/stretch/Dockerfile index d7258f97f..736bd1ef7 100644 --- a/docker/stretch/Dockerfile +++ b/docker/stretch/Dockerfile @@ -3,123 +3,14 @@ # installer. We do it in a separate stage to keep the number of dependencies low # in the final Docker image. # -FROM debian:9 as build-qt-linux-x86_64 -ARG QT_VERSION - -# Downloader dependencies -RUN apt-get update -qq && \ - apt-get install -qq -y --no-install-recommends \ - ca-certificates \ - xz-utils \ - wget - -# Download -RUN mkdir -p /qt/source && \ - wget -nv --continue --tries=20 --waitretry=10 --retry-connrefused \ - --no-dns-cache --timeout 300 -qO- \ - https://download.qt.io/official_releases/qt/${QT_VERSION%??}/${QT_VERSION}/single/qt-everywhere-src-${QT_VERSION}.tar.xz \ - | tar --strip-components=1 -C /qt/source -xJf- - -# Build dependencies -RUN apt-get update -qq && \ - apt-get install -qq -y --no-install-recommends \ - autoconf \ - automake \ - autopoint \ - binutils \ - bison \ - build-essential \ - flex \ - intltool \ - libclang-3.9-dev \ - libgdk-pixbuf2.0-dev \ - libffi-dev \ - libfontconfig1-dev \ - libfreetype6-dev \ - libgmp-dev \ - libicu-dev \ - libmpc-dev \ - libmpfr-dev \ - libtool \ - libtool-bin \ - libx11-dev \ - libxext-dev \ - libxfixes-dev \ - libxi-dev \ - libxrender-dev \ - libxcb1-dev \ - libx11-xcb-dev \ - libxcb-glx0-dev \ - libz-dev \ - python \ - openssl - -ENV LLVM_INSTALL_DIR=/usr/lib/llvm-3.9 - -# Build Qt -RUN mkdir -p qt/build && \ - cd qt/build && \ - ../source/configure \ - -prefix /opt/qt5-linux-x86_64 \ - -release \ - -shared \ - -opensource \ - -confirm-license \ - -nomake examples \ - -nomake tests \ - -platform linux-g++ \ - -no-use-gold-linker \ - -R . \ - -sysconfdir /etc/xdg \ - -qt-freetype -qt-harfbuzz -qt-pcre -qt-sqlite -qt-xcb -qt-zlib \ - -no-cups -no-dbus -no-pch -no-libudev \ - -no-feature-accessibility -no-opengl \ - -skip qtactiveqt \ - -skip qt3d \ - -skip qtcanvas3d \ - -skip qtcharts \ - -skip qtconnectivity \ - -skip qtdatavis3d \ - -skip qtdoc \ - -skip qtgamepad \ - -skip qtgraphicaleffects \ - -skip qtimageformats \ - -skip qtlocation \ - -skip qtmultimedia \ - -skip qtnetworkauth \ - -skip qtquickcontrols \ - -skip qtquickcontrols2 \ - -skip qtpurchasing \ - -skip qtremoteobjects \ - -skip qtscxml \ - -skip qtsensors \ - -skip qtserialbus \ - -skip qtspeech \ - -skip qtsvg \ - -skip qttranslations \ - -skip qtwayland \ - -skip qtvirtualkeyboard \ - -skip qtwebchannel \ - -skip qtwebengine \ - -skip qtwebsockets \ - -skip qtwebview \ - -skip qtwinextras \ - -skip qtxmlpatterns \ - -skip qtx11extras - -RUN cd qt/build && \ - make -j $(nproc --all) | stdbuf -o0 tr -cd '\n' | stdbuf -o0 tr '\n' '.' && \ - make install - -# Build a stable Qbs release FROM debian:9 LABEL Description="Debian development environment for Qbs with Qt and various dependencies for testing Qbs modules and functionality" -ARG QBS_VERSION=1.13.0 +ARG QT_VERSION +ARG QTCREATOR_VERSION # Allow colored output on command line. ENV TERM=xterm-color - # # Make it possible to change UID/GID in the entrypoint script. The docker # container usually runs as root user on Linux hosts. When the Docker container @@ -131,7 +22,8 @@ ENV TERM=xterm-color ARG USER_UID=1000 ARG USER_NAME=devel RUN apt-get update -qq && \ - apt-get install -qq -y \ + apt-get install -qq -y --no-install-recommends \ + ca-certificates \ gosu \ sudo && \ groupadd -g ${USER_UID} ${USER_NAME} && \ @@ -139,46 +31,43 @@ RUN apt-get update -qq && \ usermod -a -G sudo ${USER_NAME} && \ echo "%devel ALL = (ALL) NOPASSWD: ALL" >> /etc/sudoers -COPY entrypoint.sh entrypoint.sh +COPY docker/stretch/entrypoint.sh entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] -# Qbs build dependencies -RUN apt-get update -qq && \ - apt-get install -qq -y --no-install-recommends \ + +# Build and run dependencies for Qbs +RUN apt-get install -qq -y --no-install-recommends \ build-essential \ - ca-certificates \ + curl \ git \ + help2man \ libclang-3.9 \ - libicu57 \ - pkg-config \ + libdbus-1-3 \ + libgl1-mesa-glx \ + libfreetype6 \ + libfontconfig1 \ + libgl1-mesa-dev \ make \ - help2man \ + pkg-config \ python-pip \ - wget && \ + p7zip-full && \ pip install beautifulsoup4 lxml # for building the documentation -# Install Qt installation from build stage -COPY --from=build-qt-linux-x86_64 /opt/qt5-linux-x86_64 /opt/qt5-linux-x86_64 -ENV PATH=/opt/qt5-linux-x86_64/bin:${PATH} -RUN echo "export PATH=/opt/qt5-linux-x86_64/bin:\${PATH}" > /etc/profile.d/qt.sh +ENV LLVM_INSTALL_DIR=/usr/lib/llvm-3.9 + +COPY scripts/install-qt.sh install-qt.sh + +RUN ./install-qt.sh --version ${QT_VERSION} qtbase qtdeclarative qtscript qttools qtx11extras icu && \ + ./install-qt.sh --version ${QTCREATOR_VERSION} qtcreator && \ + echo "export PATH=/opt/Qt/${QT_VERSION}/gcc_64/bin:/opt/Qt/Tools/QtCreator/bin:\${PATH}" > /etc/profile.d/qt.sh -# Download and build Qbs -RUN mkdir -p /qbs && \ - wget -nv --continue --tries=20 --waitretry=10 --retry-connrefused \ - --no-dns-cache --timeout 300 -qO- \ - http://download.qt.io/official_releases/qbs/${QBS_VERSION}/qbs-src-${QBS_VERSION}.tar.gz \ - | tar --strip-components=1 -C /qbs -xzf- && \ - cd /qbs && \ - qmake -r qbs.pro && \ - make -j $(nproc --all) && \ - make install INSTALL_ROOT=/ && \ - rm -rf /qbs +ENV PATH=/opt/Qt/${QT_VERSION}/gcc_64/bin:/opt/Qt/Tools/QtCreator/bin:${PATH} # Configure Qbs USER $USER_NAME RUN qbs-setup-toolchains --detect && \ - qbs-setup-qt /opt/qt5-linux-x86_64/bin/qmake qt5-linux-x86_64 && \ - qbs config defaultProfile qt5-linux-x86_64 + qbs-setup-qt /opt/Qt/${QT_VERSION}/gcc_64/bin/qmake qt && \ + qbs config defaultProfile qt # Switch back to root user for the entrypoint script. USER root -- cgit v1.2.3