-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinux-x86_64.docker
139 lines (123 loc) · 3.95 KB
/
linux-x86_64.docker
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# ========================================
# Qt5 with Qbs build environment for Linux
# ========================================
FROM rweickelt/qbs:1.10.1 as build-environment
RUN apt-get update -qq \
&& apt-get install -y --no-install-recommends \
autoconf \
automake \
autopoint \
binutils \
bison \
build-essential \
ca-certificates \
flex \
intltool \
libgdk-pixbuf2.0-dev \
libffi-dev \
libgmp-dev \
libmpc-dev \
libmpfr-dev \
libtool \
libtool-bin \
libz-dev \
openssl \
patch \
pkg-config \
p7zip-full \
texinfo \
xz-utils \
wget
# Preapre and download cross development environment
RUN mkdir /build
WORKDIR /build
RUN wget -nv --continue --tries=20 --waitretry=10 --retry-connrefused \
--no-dns-cache --timeout 300 \
https://download.qt.io/official_releases/qt/5.9/5.9.8/single/qt-everywhere-opensource-src-5.9.8.tar.xz \
&& tar xf qt-everywhere-opensource-src-5.9.8.tar.xz
WORKDIR /build/qt-everywhere-opensource-src-5.9.8
RUN ./configure \
-prefix /opt/qt5-linux-x86_64 \
-release \
-shared \
-opensource \
-confirm-license \
-no-compile-examples \
-nomake tests \
-platform linux-g++-64 \
-qt-pcre -no-icu -no-glib -no-sql-sqlite -no-cups -no-dbus \
-no-pch -no-sql-odbc -no-qml-debug -qt-zlib \
-no-gui -no-freetype -no-gif -no-libpng -no-libjpeg -no-harfbuzz -no-feature-accessibility -no-opengl -no-iconv -no-xcb -no-sm \
-skip qtactiveqt \
-skip qt3d \
-skip qtcanvas3d \
-skip qtcharts \
-skip qtconnectivity \
-skip qtgamepad \
-skip qtgraphicaleffects \
-skip qtimageformats \
-skip qtlocation \
-skip qtmultimedia \
-skip qtquickcontrols \
-skip qtquickcontrols2 \
-skip qtpurchasing \
-skip qtscript \
-skip qtscxml \
-skip qtsensors \
-skip qtserialbus \
-skip qtspeech \
-skip qtsvg \
-skip qtwayland \
-skip qtvirtualkeyboard \
-skip qtwebchannel \
-skip qtwebengine \
-skip qtwebview
# Apply patches
ADD patches /patches
RUN cd qtdeclarative; git apply /patches/qtdeclarative/*.patch
# Build Qt. Make will always exit with 2 because it expects gui enabled
# which is not the case.
RUN (make -j5 2>&1; exit 0) | tee build.log\
&& (make install 2>&1; exit 0) | tee -a build.log
# A simple test to see if the Qt installation works
WORKDIR /build
COPY test test
WORKDIR /build/test
RUN /opt/qt5-linux-x86_64/bin/qmake hello-world.pro \
&& make
# ======================================
# The final image without build packages
# ======================================
FROM rweickelt/qbs:1.10.1
#
# Allow colored output on command line.
#
ENV TERM=xterm-color
#
# Make it possible to change the user in the entrypoint script.
# The docker container usually runs as root user. This usually causes permission
# problems on files created during build in the project directory.
# 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 && apt-get install -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"]
#
# Import qt build artifacts
#
COPY --from=build-environment /opt/qt5-linux-x86_64 /opt/qt5-linux-x86_64
ENV PATH="/opt/qt5-linux-x86_64/bin:${PATH}"
USER $USER_NAME
RUN qbs setup-toolchains --detect \
&& qbs setup-qt /opt/qt5-linux-x86_64/bin/qmake qt5 \
&& qbs config defaultProfile qt5 \
&& qbs config profiles.qt5.qbs.architecture x86_64
#
# Switch back to root user for the entrypoint script.
#
USER root