aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Weickelt <richard@weickelt.de>2019-04-28 15:05:19 +0200
committerRichard Weickelt <richard@weickelt.de>2019-04-29 08:05:30 +0000
commitb9e1fcce6719e6b854b39f52dadc62ec9bc0191b (patch)
tree88f8dcb910cdfaf0961dd0f8ecadc22222ed5404
parent5b0271905f491205c6c70eaa33b2c429c13f4536 (diff)
Update Debian Stretch Docker image
The Debian Docker image is outdated and the user experience is not optimal, especially when using it on Linux hosts. - Update Qt to 5.11.3 and build it from source since the Qt installer is overly complicated to use - Create a Qt profile and make it the default - Add entrypoint script to avoid file permission problems on Linux hosts - Add docker-compose.yml file for easier command line usage - Improve documentation Task-number: QBS-1402 Task-number: QBS-1438 Change-Id: I2cbe53ed115fc8cbb96c1e1305297c581e7d0589 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--doc/qbs.qdoc19
-rw-r--r--docker-compose.yml15
-rw-r--r--docker/docker.qbs2
-rw-r--r--docker/stretch/Dockerfile197
-rwxr-xr-xdocker/stretch/entrypoint.sh69
-rw-r--r--docker/stretch/qtifwsilent.qs51
6 files changed, 265 insertions, 88 deletions
diff --git a/doc/qbs.qdoc b/doc/qbs.qdoc
index 42146ec6c..0e99d5dae 100644
--- a/doc/qbs.qdoc
+++ b/doc/qbs.qdoc
@@ -523,8 +523,12 @@
The easiest way to get started is to build \QBS using a Linux container. These types of
containers are supported out of the box on all the supported host platforms: Windows, macOS,
- and Linux. Run the following to download the \QBS development image based on Debian 9
- \e Stretch:
+ and Linux. The images provide everything that is necessary to build and test \QBS:
+
+ - Qt SDK for building \QBS with \c qmake
+ - Latest stable release of \QBS for building \QBS with \QBS
+
+ Run the following to download the \QBS development image based on Debian 9 \e Stretch:
\code
docker pull qbsbuild/qbsdev:stretch
@@ -534,16 +538,19 @@
machine's file system, by running:
\code
- docker run -it -v $PWD:/qbs -w /qbs qbsbuild/qbsdev:stretch
+ docker run -it -v ${PWD}:/qbs -w /qbs qbsbuild/qbsdev:stretch
\endcode
- Or with a slightly different syntax for Windows:
+ You will now be in an interactive Linux shell where you can develop and build \QBS.
+
+ For convenience, you can also run \c docker-compose from the project root directory:
\code
- docker run -it -v %CD%:/qbs -w /qbs qbsbuild/qbsdev:stretch
+ docker-compose run --rm stretch
\endcode
- You will now be in an interactive Linux shell where you can develop and build \QBS.
+ This will download and run the container in one go and mount the project root directory
+ to \c /qbs in the container.
\section2 Windows Containers
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 000000000..916004e32
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,15 @@
+version: "3.3"
+
+services:
+ stretch:
+ image: qbsdev:stretch
+ build:
+ dockerfile: Dockerfile
+ context: docker/stretch/
+ args:
+ QT_VERSION: 5.11.3
+ QBS_VERSION: 1.13.0
+ working_dir: /qbs
+ volumes:
+ - .:/qbs
+ network_mode: bridge
diff --git a/docker/docker.qbs b/docker/docker.qbs
index 98738a9f4..d4bf181bb 100644
--- a/docker/docker.qbs
+++ b/docker/docker.qbs
@@ -13,7 +13,7 @@ Project {
files: [
"stretch/Dockerfile",
- "stretch/qtifwsilent.qs",
+ "stretch/entrypoint.sh",
]
}
diff --git a/docker/stretch/Dockerfile b/docker/stretch/Dockerfile
index 27bd668b6..9c19d26f9 100644
--- a/docker/stretch/Dockerfile
+++ b/docker/stretch/Dockerfile
@@ -1,31 +1,168 @@
+#
+# Downloads and builds Qt from source. This is simpler than using the Qt online
+# 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 \
+ libgdk-pixbuf2.0-dev \
+ libffi-dev \
+ libfontconfig1-dev \
+ libfreetype6-dev \
+ libgmp-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 \
+ openssl
+
+# Build Qt
+RUN mkdir -p qt/build && \
+ cd qt/build && \
+ ../source/configure \
+ -prefix /opt/qt5-linux-x86_64 \
+ -release \
+ -shared \
+ -opensource \
+ -confirm-license \
+ -no-compile-examples \
+ -nomake tests \
+ -platform linux-g++ \
+ -qt-freetype -qt-harfbuzz -qt-pcre -qt-xcb -qt-zlib \
+ -no-sql-sqlite -no-cups -no-dbus -no-pch \
+ -no-feature-accessibility -no-opengl \
+ -skip qtactiveqt \
+ -skip qt3d \
+ -skip qtcanvas3d \
+ -skip qtcharts \
+ -skip qtconnectivity \
+ -skip qtdeclarative \
+ -skip qtdatavis3d \
+ -skip qtdoc \
+ -skip qtgamepad \
+ -skip qtgraphicaleffects \
+ -skip qtimageformats \
+ -skip qtlocation \
+ -skip qtmultimedia \
+ -skip qtquickcontrols \
+ -skip qtquickcontrols2 \
+ -skip qtpurchasing \
+ -skip qtremoteobjects \
+ -skip qtscxml \
+ -skip qtsensors \
+ -skip qtserialbus \
+ -skip qtspeech \
+ -skip qtsvg \
+ -skip qttranslations \
+ -skip qttools \
+ -skip qtwayland \
+ -skip qtvirtualkeyboard \
+ -skip qtwebchannel \
+ -skip qtwebengine \
+ -skip qtwebsockets \
+ -skip qtwebview \
+ -skip qtwinextras \
+ -skip qtxmlpatterns \
+ && \
+ make -j $(nproc --all) >/dev/null && \
+ make install
+
+# Build a stable Qbs release
FROM debian:9
-LABEL Description="Debian development environment for Qbs with Qt 5.9 and various dependencies for testing Qbs modules and functionality"
-
-# Dependencies of the Qt offline installer
-RUN apt-get -y update && apt-get install -y \
- curl \
- libdbus-1-3 \
- libexpat1 \
- libfontconfig1 \
- libfreetype6 \
- libgl1-mesa-glx \
- libglib2.0-0 \
- libx11-6 \
- libx11-xcb1
-
-COPY qtifwsilent.qs qtifwsilent.qs
-RUN curl -L -O 'https://download.qt.io/official_releases/qt/5.9/5.9.3/qt-opensource-linux-x64-5.9.3.run' && \
- chmod +x qt-opensource-linux-x64-5.9.3.run && \
- QT_INSTALL_DIR=/usr/local/Qt ./qt-opensource-linux-x64-5.9.3.run --platform minimal --script qtifwsilent.qs && \
- rm -f qt-opensource-linux-x64-5.9.3.run
-ENV QTDIR /usr/local/Qt/5.9.3/gcc_64
-ENV PATH="/usr/local/Qt/Tools/QtCreator/bin:${PATH}"
-
-RUN ls "$QTDIR" && stat "$QTDIR/lib/libQt5Script.so" && qbs --version
-RUN apt-get -y update && apt-get install -y \
- g++ \
- gcc \
- git \
- help2man \
- python-pip
-RUN pip install beautifulsoup4 lxml # for building the documentation
+LABEL Description="Debian development environment for Qbs with Qt and various dependencies for testing Qbs modules and functionality"
+ARG QBS_VERSION=1.13.0
+
+# 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
+# mounts a folder on the host and creates files there, those files would be
+# owned by root instead of the current user. Thus we create a user here who's
+# UID will be changed in the entrypoint script to match the UID of the current
+# host user.
+#
+ARG USER_UID=1000
+ARG USER_NAME=devel
+RUN apt-get update -qq && \
+ apt-get install -qq -y \
+ gosu && \
+ groupadd -g ${USER_UID} ${USER_NAME} && \
+ useradd -s /bin/bash -u ${USER_UID} -g ${USER_NAME} -o -c "" -m ${USER_NAME}
+COPY entrypoint.sh entrypoint.sh
+ENTRYPOINT ["/entrypoint.sh"]
+
+# Qbs build dependencies
+RUN apt-get update -qq && \
+ apt-get install -qq -y --no-install-recommends \
+ build-essential \
+ ca-certificates \
+ git \
+ pkg-config \
+ make \
+ help2man \
+ python-pip \
+ wget && \
+ 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}
+
+# 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
+
+# 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
+
+# Switch back to root user for the entrypoint script.
+USER root
diff --git a/docker/stretch/entrypoint.sh b/docker/stretch/entrypoint.sh
new file mode 100755
index 000000000..f859c2264
--- /dev/null
+++ b/docker/stretch/entrypoint.sh
@@ -0,0 +1,69 @@
+#!/usr/bin/env bash
+set -eu
+
+#############################################################################
+##
+## Copyright (C) 2019 Richard Weickelt <richard@weickelt.de>
+## Contact: https://www.qt.io/licensing/
+##
+## This file is part of Qbs.
+##
+## $QT_BEGIN_LICENSE:LGPL$
+## Commercial License Usage
+## Licensees holding valid commercial Qt licenses may use this file in
+## accordance with the commercial license agreement provided with the
+## Software or, alternatively, in accordance with the terms contained in
+## a written agreement between you and The Qt Company. For licensing terms
+## and conditions see https://www.qt.io/terms-conditions. For further
+## information use the contact form at https://www.qt.io/contact-us.
+##
+## GNU Lesser General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU Lesser
+## General Public License version 3 as published by the Free Software
+## Foundation and appearing in the file LICENSE.LGPL3 included in the
+## packaging of this file. Please review the following information to
+## ensure the GNU Lesser General Public License version 3 requirements
+## will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+##
+## GNU General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 2.0 or (at your option) the GNU General
+## Public license version 3 or any later version approved by the KDE Free
+## Qt Foundation. The licenses are as published by the Free Software
+## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+## included in the packaging of this file. Please review the following
+## information to ensure the GNU General Public License requirements will
+## be met: https://www.gnu.org/licenses/gpl-2.0.html and
+## https://www.gnu.org/licenses/gpl-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+#
+# Try to determine the uid of the working directory and adjust the current
+# user's uid/gid accordingly.
+#
+WORKDIR_GID=$(stat -c "%g" .)
+WORKDIR_UID=$(stat -c "%u" .)
+USER_NAME=${USER_NAME:-devel}
+EXEC=""
+
+if [ "$(id -u ${USER_NAME})" != "0" ] && [ "${WORKDIR_UID}" != "0" ] ; then
+
+ export HOME=/home/${USER_NAME}
+
+ if [ "$(id -u ${USER_NAME})" != "${WORKDIR_UID}" ]; then
+ usermod -u ${WORKDIR_UID} ${USER_NAME}
+ groupmod -g ${WORKDIR_GID} ${USER_NAME}
+ chown -R -h ${WORKDIR_UID} /home;
+ chgrp -R -h ${WORKDIR_GID} /home;
+ fi
+ EXEC="exec gosu ${USER_NAME}:${USER_NAME}"
+fi
+
+if [ -z "$1" ]; then
+ ${EXEC} bash --login
+else
+ ${EXEC} bash --login -c "$*"
+fi
diff --git a/docker/stretch/qtifwsilent.qs b/docker/stretch/qtifwsilent.qs
deleted file mode 100644
index 804a4be25..000000000
--- a/docker/stretch/qtifwsilent.qs
+++ /dev/null
@@ -1,51 +0,0 @@
-function Controller() {
- installer.autoRejectMessageBoxes();
- installer.installationFinished.connect(function() {
- gui.clickButton(buttons.NextButton);
- })
-}
-
-Controller.prototype.WelcomePageCallback = function() {
- gui.clickButton(buttons.NextButton);
-}
-
-Controller.prototype.CredentialsPageCallback = function() {
- gui.clickButton(buttons.NextButton);
-}
-
-Controller.prototype.IntroductionPageCallback = function() {
- gui.clickButton(buttons.NextButton);
-}
-
-Controller.prototype.TargetDirectoryPageCallback = function() {
- gui.currentPageWidget().TargetDirectoryLineEdit.setText(installer.environmentVariable("QT_INSTALL_DIR"));
- gui.clickButton(buttons.NextButton);
-}
-
-Controller.prototype.ComponentSelectionPageCallback = function() {
- var widget = gui.currentPageWidget();
- widget.deselectAll();
- widget.selectComponent("qt.593.gcc_64");
- widget.selectComponent("qt.593.qtscript");
- gui.clickButton(buttons.NextButton);
-}
-
-Controller.prototype.LicenseAgreementPageCallback = function() {
- gui.currentPageWidget().AcceptLicenseRadioButton.setChecked(true);
- gui.clickButton(buttons.NextButton);
-}
-
-Controller.prototype.StartMenuDirectoryPageCallback = function() {
- gui.clickButton(buttons.NextButton);
-}
-
-Controller.prototype.ReadyForInstallationPageCallback = function() {
- gui.clickButton(buttons.NextButton);
-}
-
-Controller.prototype.FinishedPageCallback = function() {
- var checkBoxForm = gui.currentPageWidget().LaunchQtCreatorCheckBoxForm;
- if (checkBoxForm && checkBoxForm.launchQtCreatorCheckBox)
- checkBoxForm.launchQtCreatorCheckBox.checked = false;
- gui.clickButton(buttons.FinishButton);
-}