Files
asteria-qt/docker/Dockerfile.build
T

93 lines
4.7 KiB
INI

FROM ubuntu:24.04
ARG QT_VERSION=6.10.1
ARG QT_INSTALL_DIR=/opt/qt
ENV DEBIAN_FRONTEND=noninteractive
ENV QT_VERSION=${QT_VERSION}
ENV QT_INSTALL_DIR=${QT_INSTALL_DIR}
# ── Build tools & native deps ──────────────────────────────────────────────────
RUN apt-get update -qq && \
apt-get install -y --no-install-recommends \
python3 python3-pip \
cmake ninja-build pkg-config git \
build-essential libgl1-mesa-dev \
gcc g++ mingw-w64 \
libuchardet-dev \
libquazip1-qt6-dev libminizip-dev \
libdjvulibre-dev libwpd-dev \
&& rm -rf /var/lib/apt/lists/*
# ── aqtinstall ─────────────────────────────────────────────────────────────────
RUN pip3 install --quiet --break-system-packages aqtinstall
# ── Qt 6 for Linux (native build + host tools for cross-compile) ───────────────
RUN aqt install-qt linux desktop ${QT_VERSION} linux_gcc_64 \
--outputdir ${QT_INSTALL_DIR}
# ── Qt 6 for Windows (MinGW cross-compile target) ─────────────────────────────
RUN aqt install-qt windows desktop ${QT_VERSION} win64_mingw \
--outputdir ${QT_INSTALL_DIR}
# ── libiconv for MinGW (static, cross-compiled) ───────────────────────────────
COPY scripts/mingw-w64-toolchain.cmake /opt/mingw-w64-toolchain.cmake
RUN apt-get update -qq && apt-get install -y --no-install-recommends wget && rm -rf /var/lib/apt/lists/*
RUN wget -q https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.17.tar.gz -O /tmp/libiconv.tar.gz && \
tar -xf /tmp/libiconv.tar.gz -C /tmp && \
cd /tmp/libiconv-1.17 && \
./configure --host=x86_64-w64-mingw32 --prefix=/opt/mingw-sysroot \
--enable-static --disable-shared --disable-nls && \
make -j$(nproc) && make install && \
rm -rf /tmp/libiconv-1.17 /tmp/libiconv.tar.gz
# ── uchardet for MinGW (static, cross-compiled) ───────────────────────────────
RUN git clone --depth 1 https://gitlab.freedesktop.org/uchardet/uchardet.git /tmp/uchardet && \
cmake -B /tmp/uchardet-build /tmp/uchardet -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=/opt/mingw-w64-toolchain.cmake \
-DCMAKE_INSTALL_PREFIX=/opt/mingw-sysroot \
-DBUILD_SHARED_LIBS=OFF && \
cmake --build /tmp/uchardet-build && \
cmake --install /tmp/uchardet-build && \
rm -rf /tmp/uchardet /tmp/uchardet-build
ENV QT_LINUX_DIR=${QT_INSTALL_DIR}/${QT_VERSION}/gcc_64
ENV QT_WINDOWS_DIR=${QT_INSTALL_DIR}/${QT_VERSION}/mingw_64
ENV MINGW_SYSROOT=/opt/mingw-sysroot
# ── linuxdeploy + Qt plugin (for AppImage packaging) ────────────────────────
RUN wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage \
-O /usr/local/bin/linuxdeploy && \
chmod +x /usr/local/bin/linuxdeploy && \
wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage \
-O /usr/local/bin/linuxdeploy-plugin-qt && \
chmod +x /usr/local/bin/linuxdeploy-plugin-qt
# ── FUSE not available in Docker — extract AppImage tools ────────────────────
RUN cd /tmp && \
/usr/local/bin/linuxdeploy --appimage-extract && \
mv squashfs-root /opt/linuxdeploy && \
ln -sf /opt/linuxdeploy/AppRun /usr/local/bin/linuxdeploy && \
/usr/local/bin/linuxdeploy-plugin-qt --appimage-extract && \
mv squashfs-root /opt/linuxdeploy-plugin-qt && \
ln -sf /opt/linuxdeploy-plugin-qt/AppRun /usr/local/bin/linuxdeploy-plugin-qt
# ── appimagetool (for final AppImage creation) ──────────────────────────────
RUN wget -q https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage \
-O /tmp/appimagetool && \
chmod +x /tmp/appimagetool && \
cd /tmp && /tmp/appimagetool --appimage-extract && \
mv squashfs-root /opt/appimagetool && \
ln -sf /opt/appimagetool/AppRun /usr/local/bin/appimagetool && \
rm /tmp/appimagetool
# ── file utility (needed by linuxdeploy for ELF detection) ──────────────────
RUN apt-get update -qq && \
apt-get install -y --no-install-recommends file patchelf zip && \
rm -rf /var/lib/apt/lists/*
WORKDIR /build