|
| 1 | +# Careful, the version and build date are both dates, but different formats |
| 2 | +ARG ARCH_VERSION="20200407" |
| 3 | +ARG BUILD_DATE="2020/04/22" |
| 4 | + |
| 5 | +ARG PYQT_VERSION="5.14.2" |
| 6 | +ARG PYQT_3D_VERSION="5.14.0" |
| 7 | +ARG PYQT_CHART_VERSION="5.14.0" |
| 8 | +ARG PYQT_DATA_VISUALIZATION_VERSION="5.14.0" |
| 9 | +ARG PYQT_PURCHASING_VERSION="5.14.0" |
| 10 | +ARG PYQT_WEB_ENGINE_VERSION="5.14.0" |
| 11 | + |
| 12 | +################################################################################ |
| 13 | +# Build dependencies |
| 14 | +################################################################################ |
| 15 | + |
| 16 | +FROM archlinux:${ARCH_VERSION} AS build-dep |
| 17 | + |
| 18 | +# Reuse argument from previous build scope |
| 19 | +ARG BUILD_DATE |
| 20 | + |
| 21 | +# Use Arch archive to freeze packages to a certain date |
| 22 | +RUN echo "Server=https://archive.archlinux.org/repos/${BUILD_DATE}/\$repo/os/\$arch" \ |
| 23 | + | tee /etc/pacman.d/mirrorlist && \ |
| 24 | + pacman -Syyuu --noconfirm |
| 25 | + |
| 26 | +# Install build dependencies and Qt Modules |
| 27 | +RUN pacman --noconfirm -S \ |
| 28 | + # Build stuff |
| 29 | + base-devel wget \ |
| 30 | + # PyQt stuff |
| 31 | + pyqt-builder python-sip sip5 \ |
| 32 | + # Used to build other PyQt modules in later build stages |
| 33 | + python-pyqt5 \ |
| 34 | + # Qt core |
| 35 | + qt5-base \ |
| 36 | + # Qt modules not included in qt5-base |
| 37 | + qt5-3d \ |
| 38 | + qt5-charts \ |
| 39 | + qt5-connectivity \ |
| 40 | + qt5-datavis3d \ |
| 41 | + qt5-declarative \ |
| 42 | + qt5-gamepad \ |
| 43 | + qt5-graphicaleffects \ |
| 44 | + qt5-imageformats \ |
| 45 | + qt5-location \ |
| 46 | + qt5-multimedia \ |
| 47 | + qt5-purchasing \ |
| 48 | + qt5-networkauth \ |
| 49 | + qt5-remoteobjects \ |
| 50 | + qt5-script \ |
| 51 | + qt5-sensors \ |
| 52 | + qt5-serialport \ |
| 53 | + qt5-svg \ |
| 54 | + qt5-tools \ |
| 55 | + qt5-wayland \ |
| 56 | + qt5-webchannel \ |
| 57 | + qt5-webengine \ |
| 58 | + qt5-webkit \ |
| 59 | + qt5-websockets \ |
| 60 | + qt5-x11extras \ |
| 61 | + qt5-xmlpatterns \ |
| 62 | + # Required for QtDBus |
| 63 | + python-dbus |
| 64 | + |
| 65 | +################################################################################ |
| 66 | +# PyQt5 core stubs |
| 67 | +################################################################################ |
| 68 | + |
| 69 | +FROM build-dep AS pyqt5 |
| 70 | + |
| 71 | +# Reuse argument from previous build scope |
| 72 | +ARG PYQT_VERSION |
| 73 | + |
| 74 | +# Download source tar |
| 75 | +RUN wget --no-verbose \ |
| 76 | + --output-document upstream.tar.gz \ |
| 77 | + https://pypi.io/packages/source/p/pyqt5/PyQt5-${PYQT_VERSION}.tar.gz |
| 78 | +RUN mkdir /upstream/ && \ |
| 79 | + tar -xf \ |
| 80 | + upstream.tar.gz \ |
| 81 | + --directory /upstream/ \ |
| 82 | + --strip-components 1 |
| 83 | + |
| 84 | +# Build PyQt with stubs |
| 85 | +# TODO: Find way to build only stubs. This takes way too long |
| 86 | +WORKDIR /upstream/ |
| 87 | +RUN sip-install \ |
| 88 | + --qmake /usr/bin/qmake-qt5 \ |
| 89 | + --confirm-license \ |
| 90 | + --pep484-pyi \ |
| 91 | + --build-dir ./build \ |
| 92 | + --verbose |
| 93 | + |
| 94 | +# Copy all .pyi files to output dir |
| 95 | +WORKDIR /output/ |
| 96 | +RUN find /upstream/ -name \*.pyi -exec cp {} . \; |
| 97 | + |
| 98 | +################################################################################ |
| 99 | +# PyQt3D |
| 100 | +################################################################################ |
| 101 | + |
| 102 | +FROM build-dep AS pyqt-3d |
| 103 | + |
| 104 | +# Reuse argument from previous build scope |
| 105 | +ARG PYQT_3D_VERSION |
| 106 | + |
| 107 | +# Download source tar |
| 108 | +RUN wget --no-verbose \ |
| 109 | + --output-document upstream.tar.gz \ |
| 110 | + https://pypi.io/packages/source/p/pyqt3d/PyQt3D-${PYQT_3D_VERSION}.tar.gz |
| 111 | +RUN mkdir /upstream/ && \ |
| 112 | + tar -xf \ |
| 113 | + upstream.tar.gz \ |
| 114 | + --directory /upstream/ \ |
| 115 | + --strip-components 1 |
| 116 | + |
| 117 | +# Build PyQt3D with stubs |
| 118 | +# TODO: Find way to build only stubs |
| 119 | +WORKDIR /upstream/ |
| 120 | +RUN sip-install \ |
| 121 | + --qmake /usr/bin/qmake-qt5 \ |
| 122 | + --pep484-pyi \ |
| 123 | + --build-dir ./build \ |
| 124 | + --verbose |
| 125 | + |
| 126 | +# Copy all .pyi files to output dir |
| 127 | +WORKDIR /output/ |
| 128 | +RUN find /upstream/ -name \*.pyi -exec cp {} . \; |
| 129 | + |
| 130 | +################################################################################ |
| 131 | +# PyQtChart |
| 132 | +################################################################################ |
| 133 | + |
| 134 | +FROM build-dep AS pyqt-chart |
| 135 | + |
| 136 | +# Reuse argument from previous build scope |
| 137 | +ARG PYQT_CHART_VERSION |
| 138 | + |
| 139 | +# Download source tar |
| 140 | +RUN wget --no-verbose \ |
| 141 | + --output-document upstream.tar.gz \ |
| 142 | + https://pypi.io/packages/source/p/pyqtchart/PyQtChart-${PYQT_CHART_VERSION}.tar.gz |
| 143 | +RUN mkdir /upstream/ && \ |
| 144 | + tar -xf \ |
| 145 | + upstream.tar.gz \ |
| 146 | + --directory /upstream/ \ |
| 147 | + --strip-components 1 |
| 148 | + |
| 149 | +# Build PyQtChart with stubs |
| 150 | +# TODO: Find way to build only stubs |
| 151 | +WORKDIR /upstream/ |
| 152 | +RUN sip-install \ |
| 153 | + --qmake /usr/bin/qmake-qt5 \ |
| 154 | + --pep484-pyi \ |
| 155 | + --build-dir ./build \ |
| 156 | + --verbose |
| 157 | + |
| 158 | +# Copy all .pyi files to output dir |
| 159 | +WORKDIR /output/ |
| 160 | +RUN find /upstream/ -name \*.pyi -exec cp {} . \; |
| 161 | + |
| 162 | +################################################################################ |
| 163 | +# PyQtDataVisualization |
| 164 | +################################################################################ |
| 165 | + |
| 166 | +FROM build-dep AS pyqt-data-visualization |
| 167 | + |
| 168 | +# Reuse argument from previous build scope |
| 169 | +ARG PYQT_DATA_VISUALIZATION_VERSION |
| 170 | + |
| 171 | +# Download source tar |
| 172 | +RUN wget --no-verbose \ |
| 173 | + --output-document upstream.tar.gz \ |
| 174 | + https://pypi.io/packages/source/p/pyqtdatavisualization/PyQtDataVisualization-${PYQT_DATA_VISUALIZATION_VERSION}.tar.gz |
| 175 | +RUN mkdir /upstream/ && \ |
| 176 | + tar -xf \ |
| 177 | + upstream.tar.gz \ |
| 178 | + --directory /upstream/ \ |
| 179 | + --strip-components 1 |
| 180 | + |
| 181 | +# Build PyQtDataVisualization with stubs |
| 182 | +# TODO: Find way to build only stubs |
| 183 | +WORKDIR /upstream/ |
| 184 | +RUN sip-install \ |
| 185 | + --qmake /usr/bin/qmake-qt5 \ |
| 186 | + --pep484-pyi \ |
| 187 | + --build-dir ./build \ |
| 188 | + --verbose |
| 189 | + |
| 190 | +# Copy all .pyi files to output dir |
| 191 | +WORKDIR /output/ |
| 192 | +RUN find /upstream/ -name \*.pyi -exec cp {} . \; |
| 193 | + |
| 194 | +################################################################################ |
| 195 | +# PyQtPurchasing |
| 196 | +################################################################################ |
| 197 | + |
| 198 | +FROM build-dep AS pyqt-purchasing |
| 199 | + |
| 200 | +# Reuse argument from previous build scope |
| 201 | +ARG PYQT_PURCHASING_VERSION |
| 202 | + |
| 203 | +# Download source tar |
| 204 | +RUN wget --no-verbose \ |
| 205 | + --output-document upstream.tar.gz \ |
| 206 | + https://pypi.io/packages/source/p/pyqtpurchasing/PyQtPurchasing-${PYQT_PURCHASING_VERSION}.tar.gz |
| 207 | +RUN mkdir /upstream/ && \ |
| 208 | + tar -xf \ |
| 209 | + upstream.tar.gz \ |
| 210 | + --directory /upstream/ \ |
| 211 | + --strip-components 1 |
| 212 | + |
| 213 | +# Build PyQtPurchasing with stubs |
| 214 | +# TODO: Find way to build only stubs |
| 215 | +WORKDIR /upstream/ |
| 216 | +RUN sip-install \ |
| 217 | + --qmake /usr/bin/qmake-qt5 \ |
| 218 | + --pep484-pyi \ |
| 219 | + --build-dir ./build \ |
| 220 | + --verbose |
| 221 | + |
| 222 | +# Copy all .pyi files to output dir |
| 223 | +WORKDIR /output/ |
| 224 | +RUN find /upstream/ -name \*.pyi -exec cp {} . \; |
| 225 | + |
| 226 | +################################################################################ |
| 227 | +# PyQtWebEngine |
| 228 | +################################################################################ |
| 229 | + |
| 230 | +FROM build-dep AS pyqt-web-engine |
| 231 | + |
| 232 | +# Reuse argument from previous build scope |
| 233 | +ARG PYQT_WEB_ENGINE_VERSION |
| 234 | + |
| 235 | +# Download source tar |
| 236 | +RUN wget --no-verbose \ |
| 237 | + --output-document upstream.tar.gz \ |
| 238 | + https://pypi.io/packages/source/p/pyqtwebengine/PyQtWebEngine-${PYQT_WEB_ENGINE_VERSION}.tar.gz |
| 239 | +RUN mkdir /upstream/ && \ |
| 240 | + tar -xf \ |
| 241 | + upstream.tar.gz \ |
| 242 | + --directory /upstream/ \ |
| 243 | + --strip-components 1 |
| 244 | + |
| 245 | +# Build PyQtWebEngine with stubs |
| 246 | +# TODO: Find way to build only stubs |
| 247 | +WORKDIR /upstream/ |
| 248 | +RUN sip-install \ |
| 249 | + --qmake /usr/bin/qmake-qt5 \ |
| 250 | + --pep484-pyi \ |
| 251 | + --build-dir ./build \ |
| 252 | + --verbose |
| 253 | + |
| 254 | +# Copy all .pyi files to output dir |
| 255 | +WORKDIR /output/ |
| 256 | +RUN find /upstream/ -name \*.pyi -exec cp {} . \; |
| 257 | + |
| 258 | +################################################################################ |
| 259 | +# Output |
| 260 | +################################################################################ |
| 261 | + |
| 262 | +FROM scratch AS output |
| 263 | + |
| 264 | +# Get all the outputs from the build layers |
| 265 | +WORKDIR /output/ |
| 266 | +COPY --from=pyqt5 /output/* ./ |
| 267 | +COPY --from=pyqt-3d /output/* ./ |
| 268 | +COPY --from=pyqt-chart /output/* ./ |
| 269 | +COPY --from=pyqt-data-visualization /output/* ./ |
| 270 | +COPY --from=pyqt-purchasing /output/* ./ |
| 271 | +COPY --from=pyqt-web-engine /output/* ./ |
| 272 | + |
| 273 | +# Required to run the image (which we need to do to get the files) |
| 274 | +CMD /bin/true |
0 commit comments