@@ -111,29 +111,61 @@ RUN \
111111 && rm -rf /var/lib/apt/lists/*
112112
113113# =============================================================================
114- # Stage 3: Qt Installation - extends qt-dev-base
114+ # Stage 3: Qt Builder - builds Qt from source
115+ # =============================================================================
116+ FROM qt-dev-base AS qt-builder
117+
118+ ARG QTVER
119+
120+ COPY ../../scripts/build_qt_*.sh /root/scripts/
121+
122+ # Build Qt from source
123+ RUN \
124+ echo "Building Qt from source..." && \
125+ mkdir -p /root/export && \
126+ cd /root && \
127+ /root/scripts/build_qt_android.sh && \
128+ if [ -f "/root/scripts/build_qt_desktop.sh" ]; then \
129+ /root/scripts/build_qt_desktop.sh; \
130+ fi
131+
132+ # =============================================================================
133+ # Stage 4: Qt Export - creates Qt tar.xz files from built Qt
134+ # =============================================================================
135+ FROM scratch AS qt-export
136+
137+ # Copy Qt exports from builder stage
138+ COPY --from=qt-builder /root/export/ /qt_export/
139+
140+ # =============================================================================
141+ # Stage 5: Qt Installation - installs Qt from exports
115142# inspired by https://github.com/carlonluca/docker-qt/blob/master/Dockerfile_6.9.0
116143# =============================================================================
117144FROM qt-dev-base AS qt-installation
118145
119146ARG QTVER
120147
121- COPY qt_export/Qt-android-$QTVER.tar.xz /root/
122- COPY qt_export/Qt-amd64-$QTVER.tar.xz* / root/
148+ # Get Qt exports from the qt-export stage
149+ COPY --from=qt-export /qt_export/ / root/qt_export /
123150
124- # Extract Qt Android
151+ # Extract Qt if the tar.xz files exist
125152RUN \
126153 mkdir -p /opt/qt/$QTVER && \
127- cd /opt/qt/$QTVER && \
128- tar xvfp /root/Qt-android-$QTVER.tar.xz && \
129- rm /root/Qt-android-$QTVER.tar.xz
130-
131- RUN \
132- if [ -f /root/Qt-amd64-$QTVER.tar.xz ]; then \
154+ if [ -f "/root/qt_export/Qt-android-$QTVER.tar.xz" ]; then \
155+ echo "Installing Qt Android from export..." ; \
133156 cd /opt/qt/$QTVER && \
134- tar xvfp /root/Qt-amd64-$QTVER.tar.xz && \
135- rm /root/Qt-amd64-$QTVER.tar.xz; \
136- fi
157+ tar xvfp /root/qt_export/Qt-android-$QTVER.tar.xz; \
158+ else \
159+ echo "No Qt Android export found, skipping..." ; \
160+ fi && \
161+ if [ -f "/root/qt_export/Qt-amd64-$QTVER.tar.xz" ]; then \
162+ echo "Installing Qt desktop from export..." ; \
163+ cd /opt/qt/$QTVER && \
164+ tar xvfp /root/qt_export/Qt-amd64-$QTVER.tar.xz; \
165+ else \
166+ echo "No Qt desktop export found, skipping..." ; \
167+ fi && \
168+ rm -rf /root/qt_export
137169
138170RUN \
139171 apt-get -y autoremove \
@@ -219,7 +251,7 @@ RUN GOLANG_SHA256="535f9f81802499f2a7dbfa70abb8fda3793725fcc29460f719815f6e10b5f
219251# Install Go tools as root first, then copy to accessible location
220252RUN /usr/local/go/bin/go install github.com/go-bindata/go-bindata/v3/go-bindata@latest \
221253 && /usr/local/go/bin/go install go.uber.org/mock/
[email protected] \
222- && /usr/local/go/bin/go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28 .1 \
254+ && /usr/local/go/bin/go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34 .1 \
223255 && cp /root/go/bin/* /usr/local/bin/ 2>/dev/null || true
224256
225257# Configure Qt library path
@@ -362,26 +394,6 @@ RUN apt update -yq && apt install -yq software-properties-common \
362394 --slave /usr/bin/g++ g++ /usr/bin/g++-9 \
363395 && apt-get -qq clean
364396
365- # Install Protoc (only if not already present from previous stages)
366- RUN if ! command -v protoc &> /dev/null; then \
367- PROTOC_SHA256="75d8a9d7a2c42566e46411750d589c51276242d8b6247a5724bac0f9283e05a8" \
368- && PROTOC_TARBALL="protoc-3.20.0-linux-x86_64.zip" \
369- && wget -q -L "https://github.com/protocolbuffers/protobuf/releases/download/v3.20.0/${PROTOC_TARBALL}" \
370- && echo "${PROTOC_SHA256} ${PROTOC_TARBALL}" | sha256sum -c \
371- && sudo unzip -d /usr/local "${PROTOC_TARBALL}" \
372- && rm "${PROTOC_TARBALL}" ; \
373- fi
374-
375- # Install Protoc-gen-go (only if not already present)
376- RUN if ! command -v protoc-gen-go &> /dev/null; then \
377- PROTOC_GEN_SHA256="0b2c257938a8cd9ba3506bbdbbaad45e51245b6f9e0743035ade7acf746c6be7" \
378- && PROTOC_GEN_TARBALL="protoc-gen-go.v1.34.1.linux.amd64.tar.gz" \
379- && wget -q -L "https://github.com/protocolbuffers/protobuf-go/releases/download/v1.34.1/${PROTOC_GEN_TARBALL}" \
380- && echo "${PROTOC_GEN_SHA256} ${PROTOC_GEN_TARBALL}" | sha256sum -c \
381- && sudo tar -C /usr/local/bin -xzf "${PROTOC_GEN_TARBALL}" \
382- && rm "${PROTOC_GEN_TARBALL}" ; \
383- fi
384-
385397ENV PATH="/root/go/bin:${PATH}"
386398
387399LABEL description="Build image for the Status-tablet Android APK."
0 commit comments