vpnhide/.github/docker/ci/Dockerfile
okhsunrog e57417b686
Some checks are pending
CI / kmod (android14-5.15) (push) Waiting to run
CI / kmod (android14-6.1) (push) Waiting to run
CI / kmod (android15-6.6) (push) Waiting to run
CI / kmod (android16-6.12) (push) Waiting to run
CI / setup (push) Waiting to run
CI / lint (push) Blocked by required conditions
CI / kmod (android12-5.10) (push) Waiting to run
CI / kmod (android13-5.10) (push) Waiting to run
CI / kmod (android13-5.15) (push) Waiting to run
CI / zygisk (push) Blocked by required conditions
CI / lsposed (push) Blocked by required conditions
CI / portshide (push) Waiting to run
CI / release (push) Blocked by required conditions
ci: drop broken uniffi-bindgen pre-install from CI image
#106 added \`cargo install uniffi-bindgen --version "^0.29" --locked\`,
which fails ci-image rebuilds:

  error: could not find \`uniffi-bindgen\` in registry \`crates-io\`
         with version \`^0.29\`

Two errors in the original change:
  1. The crate Gobley installs is \`gobley-uniffi-bindgen\` (its own
     fork on crates.io at 0.3.7), not upstream \`uniffi-bindgen\`.
  2. Gobley installs the binary into \`app/build/gobley-tools-install/
     uniffi-bindgen/\`, not \`~/.cargo/bin\`. A globally pre-installed
     binary wouldn't satisfy the task's UP-TO-DATE check anyway.

\`org.gradle.caching=true\` from #106 already makes
\`installUniffiBindgen\` go UP-TO-DATE on warm runs (verified locally),
so the optimisation is in effect via the build cache instead.
2026-04-27 00:41:09 +03:00

86 lines
3.9 KiB
Docker

# CI image for vpnhide.
#
# Bakes in everything needed for all three modules:
# - Rust + NDK + cargo-ndk (zygisk)
# - JDK 17 (lsposed, test-app)
# - Google AOSP clang + cross-compile tools (kmod)
#
# Rebuilt by ci-image.yml when this Dockerfile changes (and monthly).
FROM ubuntu:24.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates curl unzip zip xz-utils \
build-essential pkg-config \
cmake ninja-build \
openjdk-17-jdk-headless \
bc kmod cpio flex bison libssl-dev libelf-dev \
binutils-aarch64-linux-gnu \
clang-format \
git && \
rm -rf /var/lib/apt/lists/*
# ── ktlint (for lsposed / test-app Kotlin) ──────────────────────────
ENV KTLINT_VERSION=1.8.0
RUN curl -fsSL -o /usr/local/bin/ktlint \
"https://github.com/pinterest/ktlint/releases/download/${KTLINT_VERSION}/ktlint" && \
chmod +x /usr/local/bin/ktlint
# ── Android SDK (for lsposed) ────────────────────────────────────────
ENV ANDROID_HOME=/opt/android-sdk
ENV PATH="${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${PATH}"
RUN mkdir -p "${ANDROID_HOME}/cmdline-tools" && \
curl -fsSL -o /tmp/cmdline-tools.zip \
"https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip" && \
unzip -q /tmp/cmdline-tools.zip -d /tmp/cmdline-tools && \
mv /tmp/cmdline-tools/cmdline-tools "${ANDROID_HOME}/cmdline-tools/latest" && \
rm -rf /tmp/cmdline-tools.zip /tmp/cmdline-tools && \
yes | sdkmanager --licenses > /dev/null 2>&1 && \
sdkmanager "platform-tools" "platforms;android-35" "build-tools;35.0.0" && \
chmod -R a+rx "${ANDROID_HOME}"
# ── Rust toolchain (for zygisk) ──────────────────────────────────────
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
sh -s -- -y --default-toolchain stable --profile minimal --no-modify-path && \
rustup target add aarch64-linux-android && \
rustup component add rustfmt clippy && \
cargo install cargo-ndk --locked && \
chmod -R a+w /usr/local/rustup /usr/local/cargo
# ── Android NDK (for zygisk) ─────────────────────────────────────────
ENV ANDROID_NDK_VERSION=r28b
ENV ANDROID_NDK_HOME=/opt/android-ndk
# Gobley's cargo plugin reads ANDROID_NDK_ROOT (not _HOME) to find the NDK
# when looking up the toolchain library directory for Android Rust targets.
ENV ANDROID_NDK_ROOT=/opt/android-ndk
RUN curl -fsSL -o /tmp/ndk.zip \
"https://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux.zip" && \
unzip -q /tmp/ndk.zip -d /opt && \
mv "/opt/android-ndk-${ANDROID_NDK_VERSION}" "${ANDROID_NDK_HOME}" && \
rm /tmp/ndk.zip && \
chmod -R a+rx "${ANDROID_NDK_HOME}"
# ── Google AOSP clang (for kmod) ─────────────────────────────────────
# Same toolchain that built the Pixel GKI kernel — avoids ABI mismatches
# that cause bootloops with distro clang.
ENV AOSP_CLANG_VERSION=clang-r487747c
ENV AOSP_CLANG_DIR=/opt/aosp-clang
RUN git clone --depth=1 --filter=blob:none --sparse \
-b android-gs-shusky-6.1-android16 \
https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86 \
/tmp/clang-repo && \
cd /tmp/clang-repo && \
git sparse-checkout set ${AOSP_CLANG_VERSION} && \
mv ${AOSP_CLANG_VERSION} ${AOSP_CLANG_DIR} && \
rm -rf /tmp/clang-repo && \
chmod -R a+rx ${AOSP_CLANG_DIR}