1+ FROM statusteam/nim-status-client-build:1.0.0-qt6.9.0-android
2+
3+ ARG GOLANG_VERSION="1.23.10"
4+ ARG NIM_VERSION="2.0.12"
5+ ARG NIX_VERSION="2.24.11"
6+
7+ LABEL description="Complete Android build environment with Qt, Nim, and all tooling"
8+ LABEL qt.version="6.9.0"
9+ LABEL nim.version="${NIM_VERSION}"
10+ LABEL base.image="statusteam/nim-status-client-build:1.0.0-qt6.9.0-android"
11+
12+ ENV DEBIAN_FRONTEND=noninteractive
13+
14+ # Create jenkins user with specific UID/GID for compatibility
15+ RUN groupadd -g 1001 jenkins && useradd -r -g jenkins -m -d /home/jenkins -s /bin/bash -u 1001 jenkins
16+
17+ # Install additional runtime dependencies
18+ RUN apt-get update && apt-get install -y --no-install-recommends \
19+ curl \
20+ git \
21+ unzip \
22+ wget \
23+ build-essential \
24+ software-properties-common \
25+ gnupg2 \
26+ ca-certificates \
27+ locales \
28+ file \
29+ xz-utils \
30+ python3 \
31+ python3-pip \
32+ python3-venv \
33+ perl \
34+ sudo \
35+ pkg-config \
36+ cmake \
37+ ninja-build \
38+ libgl1-mesa-dev \
39+ libfontconfig1 \
40+ libdbus-1-3 \
41+ && apt-get clean \
42+ && rm -rf /var/lib/apt/lists/* \
43+ && rm -rf /tmp/* \
44+ && rm -rf /var/tmp/*
45+
46+ # Configure locales
47+ RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
48+ ENV LANG=en_US.UTF-8
49+ ENV LANGUAGE=en_US:en
50+ ENV LC_ALL=en_US.UTF-8
51+
52+ # Give jenkins sudo access
53+ RUN echo "jenkins ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
54+
55+ # Create nix directory
56+ RUN mkdir /nix && chown jenkins:jenkins /nix
57+
58+ # Install/Update Golang to the version we need
59+ RUN GOLANG_SHA256="535f9f81802499f2a7dbfa70abb8fda3793725fcc29460f719815f6e10b5fd60" \
60+ && GOLANG_TARBALL="go${GOLANG_VERSION}.linux-amd64.tar.gz" \
61+ && rm -rf /usr/local/go \
62+ && wget -q "https://dl.google.com/go/${GOLANG_TARBALL}" \
63+ && echo "${GOLANG_SHA256} ${GOLANG_TARBALL}" | sha256sum -c \
64+ && tar -C /usr/local -xzf "${GOLANG_TARBALL}" \
65+ && rm "${GOLANG_TARBALL}" \
66+ && ln -sf /usr/local/go/bin/go /usr/local/bin/go \
67+ && ln -sf /usr/local/go/bin/gofmt /usr/local/bin/gofmt
68+
69+ # Install Go tools as root first, then copy to accessible location
70+ RUN /usr/local/go/bin/go install github.com/go-bindata/go-bindata/v3/go-bindata@latest \
71+ && /usr/local/go/bin/go install go.uber.org/mock/
[email protected] \
72+ && /usr/local/go/bin/go install google.golang.org/protobuf/cmd/
[email protected] \
73+ && cp /root/go/bin/* /usr/local/bin/ 2>/dev/null || true
74+
75+ # Configure Qt library path
76+ RUN echo "/opt/qt/6.9.0/gcc_64/lib" > /etc/ld.so.conf.d/qt.conf \
77+ && ldconfig
78+
79+ # Create missing Qt Android directory for compatibility
80+ RUN mkdir -p /opt/qt/6.9.0/android_arm64_v8a/lib/pkgconfig
81+
82+ # Switch to jenkins user for user-specific installations
83+ USER jenkins
84+ WORKDIR /home/jenkins
85+
86+ # Build OpenSSL for Android arm64-v8a
87+ RUN set -e \
88+ && git clone --depth 1 --branch openssl-3.0.15 https://github.com/openssl/openssl.git \
89+ && mkdir -p openssl-output/arm64-v8a \
90+ && cd openssl \
91+ && echo "Building OpenSSL for arm64-v8a..." \
92+ && export ANDROID_NDK_HOME=${ANDROID_NDK_ROOT} \
93+ && export PATH=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH \
94+ && ./Configure android-arm64 \
95+ -D__ANDROID_API__=21 \
96+ --prefix=/home/jenkins/openssl-output/arm64-v8a \
97+ --openssldir=/home/jenkins/openssl-output/arm64-v8a \
98+ no-shared \
99+ no-tests \
100+ && make -j$(($(nproc))) \
101+ && make install_sw \
102+ && make clean \
103+ && echo "OpenSSL build completed"
104+
105+ # Install Nim
106+ RUN curl https://nim-lang.org/choosenim/init.sh -sSf | sh -s -- -y \
107+ && /home/jenkins/.nimble/bin/choosenim ${NIM_VERSION}
108+
109+ # Install Nix
110+ RUN curl -s https://nixos.org/releases/nix/nix-${NIX_VERSION}/install | sh -s -- --no-daemon
111+
112+ # Install Go tools for jenkins user as well
113+ RUN /usr/local/go/bin/go install github.com/go-bindata/go-bindata/v3/go-bindata@latest \
114+ && /usr/local/go/bin/go install go.uber.org/mock/
[email protected] 115+
116+ # Switch back to root to create system-wide symlinks
117+ USER root
118+
119+ # Create symlinks for Nim tools
120+ RUN ln -sf /home/jenkins/.choosenim/toolchains/nim-${NIM_VERSION}/bin/nim /usr/local/bin/nim \
121+ && ln -sf /home/jenkins/.choosenim/toolchains/nim-${NIM_VERSION}/bin/nimble /usr/local/bin/nimble \
122+ && ln -sf /home/jenkins/.choosenim/toolchains/nim-${NIM_VERSION}/bin/choosenim /usr/local/bin/choosenim \
123+ && chmod 755 /home/jenkins/.choosenim/toolchains/nim-${NIM_VERSION}/bin/* \
124+ && chown -R root:root /home/jenkins/.choosenim/toolchains/nim-${NIM_VERSION}/bin
125+
126+ # Set comprehensive PATH with all tools
127+ ENV PATH="/opt/qt/6.9.0/gcc_64/bin:/opt/qt/6.9.0/android_arm64_v8a/bin:/usr/local/go/bin:/home/jenkins/go/bin:/opt/qt/6.9.0/gcc_64/libexec:/opt/android-sdk/cmdline-tools/latest/bin:/opt/android-sdk/platform-tools:/home/jenkins/.nix-profile/bin:/usr/local/bin:${PATH}"
128+
129+ # Set Qt and OpenSSL environment variables
130+ ENV QT_HOST_PATH="/opt/qt/6.9.0/gcc_64/"
131+ ENV QT_PLUGIN_PATH="/opt/qt/6.9.0/gcc_64/plugins"
132+ ENV OPENSSL_LIB_DIR="/home/jenkins/openssl-output/arm64-v8a/lib"
133+ ENV OPENSSL_INC_DIR="/home/jenkins/openssl-output/arm64-v8a/include"
134+
135+ # Switch back to jenkins user as default
136+ USER jenkins
137+ WORKDIR /home/jenkins
138+
139+ ENTRYPOINT ["/bin/bash" , "-l" , "-c" ]
140+
141+ LABEL maintainer="status-team"
142+ LABEL source="https://github.com/status-im/status-desktop"
0 commit comments