Files
VoelinClient/docker/android.Dockerfile
T
Claude 216e21fec5 Rename the project to Voelin; packages hold only the app, tsgw is a Linux server package
The product is Voelin (app id io.github.faumaray.Voelin), everywhere:
- crates tsc-* -> voelin-* (and voelin-fuzz), the desktop binary
  tsc-desktop -> voelin, the development CLI tsctl -> voelinctl;
- the Android app: applicationId, Kotlin package io.github.faumaray.voelin,
  VoelinApp, libvoelin_android.so (JNI class names follow);
- TSC_* environment variables -> VOELIN_*, Gradle properties tsc.* ->
  voelin.*, signing secrets VOELIN_SIGNING_*;
- the data/config/cache/state folder tsc -> voelin, the keyring service,
  thread names, the dev compose project;
- desktop file, metainfo, icon, Flatpak manifest, NSIS installer, docs.
The gateway keeps its name: bin tsgw (crate voelin-gateway), TSGW_* env
vars, the tsgw.v1+json protocol, the tsgw image. The window title and the
About page show "Voelin <version>" from voelin_platform::APP_NAME.

Packages (scripts/package.sh): the app only (voelin, voelin.exe, APKs,
Flatpak). voelinctl is a development tool and in no package. tsgw is for
servers and now its own Linux package, tsgw_<v>_amd64.deb and
tsgw-<v>-linux-x86_64.tar.gz, with a sandboxed systemd unit
(packaging/linux/tsgw.service; /etc/tsgw config, /var/lib/tsgw state) and
dependencies of its own (no GUI libraries). docs/gateway-admin.md has an
Install section.

Fixes:
- package-windows: makensis on Windows found no file through "D:/a/..."
  paths; pass Windows paths (cygpath -w).
- StartupWMClass is the app id, which the app sets as its X11 WM_CLASS
  (it was the binary name, so desktops could not match the window).
- Gradle wrapper download timeout 10 s -> 60 s (slow proxies).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
2026-09-26 21:11:17 +00:00

101 lines
4.6 KiB
Docker

# syntax=docker/dockerfile:1
#
# Android APKs (docs/building.md, docs/android.md): a debug APK, installable
# as is, for arm64-v8a and x86_64 (emulators).
#
# docker build -f docker/android.Dockerfile -o dist/android .
# docker build -f docker/android.Dockerfile --build-arg ABIS=arm64-v8a -o dist/android .
#
# or scripts/docker-build.sh android. A signed release APK needs your keystore
# (docs/release.md), passed as build secrets:
#
# docker build -f docker/android.Dockerfile --build-arg APK=release \
# --secret id=keystore,src=release.jks --secret id=signing,src=signing.env \
# -o dist/android .
#
# signing.env holds VOELIN_SIGNING_STORE_PASSWORD, VOELIN_SIGNING_KEY_ALIAS and
# VOELIN_SIGNING_KEY_PASSWORD lines (NAME=value). Without them a release APK is
# unsigned.
FROM ubuntu:24.04 AS toolchain
ARG DEBIAN_FRONTEND=noninteractive
# JDK 17 (Gradle, the Android Gradle plugin), CMake + Ninja (the bundled libopus).
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential ca-certificates cmake curl ninja-build openjdk-17-jdk-headless \
pkg-config python3 unzip \
&& rm -rf /var/lib/apt/lists/*
# Extra CA certificates (PEM, one or more), for building behind a
# TLS-inspecting proxy; scripts/docker-build.sh passes $BUILD_CA_CERT as this
# secret. One file per certificate, so the Java truststore gets each one too.
RUN --mount=type=secret,id=ca,required=false \
if [ -s /run/secrets/ca ]; then \
awk '/-----BEGIN CERTIFICATE-----/ { n++ } n { print > ("/usr/local/share/ca-certificates/build-ca-" n ".crt") }' \
/run/secrets/ca \
&& update-ca-certificates; \
fi
# Java tools do not read HTTPS_PROXY: turn it into JVM properties for
# sdkmanager and Gradle when it is set (GRADLE_OPTS for the wrapper's JVM,
# -D arguments for the build JVM).
COPY <<-'EOF' /usr/local/bin/java-proxy-opts
#!/bin/sh
p=${HTTPS_PROXY:-${https_proxy:-}}
[ -n "$p" ] || exit 0
hp=${p#*://}; hp=${hp%%/*}; hp=${hp##*@}
echo "-Dhttps.proxyHost=${hp%:*} -Dhttps.proxyPort=${hp##*:} -Dhttp.proxyHost=${hp%:*} -Dhttp.proxyPort=${hp##*:}"
EOF
RUN chmod +x /usr/local/bin/java-proxy-opts
# The SDK packages CI installs (.github/workflows/ci.yml, android job).
ENV ANDROID_HOME=/opt/android-sdk
ARG CMDLINE_TOOLS=commandlinetools-linux-16111833_latest.zip
ARG CMDLINE_TOOLS_SHA1=e025545c62a8e64c7559119566a569fb1dec5f60
ARG NDK_VERSION=27.3.13750724
RUN curl -sSfL -o /tmp/tools.zip "https://dl.google.com/android/repository/$CMDLINE_TOOLS" \
&& echo "$CMDLINE_TOOLS_SHA1 /tmp/tools.zip" | sha1sum -c - \
&& mkdir -p "$ANDROID_HOME/cmdline-tools" \
&& unzip -q /tmp/tools.zip -d "$ANDROID_HOME/cmdline-tools" \
&& mv "$ANDROID_HOME/cmdline-tools/cmdline-tools" "$ANDROID_HOME/cmdline-tools/latest" \
&& rm /tmp/tools.zip \
&& export JAVA_OPTS="$(java-proxy-opts)" \
&& yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --licenses >/dev/null \
&& "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" \
"ndk;$NDK_VERSION" "platforms;android-36" "build-tools;36.0.0" >/dev/null
ENV ANDROID_NDK_HOME=$ANDROID_HOME/ndk/$NDK_VERSION ANDROID_NDK_ROOT=$ANDROID_HOME/ndk/$NDK_VERSION
ENV RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/usr/local/cargo PATH=/usr/local/cargo/bin:$PATH
COPY rust-toolchain.toml /tmp/toolchain/
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --no-modify-path --profile minimal --default-toolchain none \
&& cd /tmp/toolchain && rustup toolchain install \
&& rustup target add --toolchain "$(sed -n 's/^channel = "\(.*\)"/\1/p' rust-toolchain.toml)" \
aarch64-linux-android x86_64-linux-android armv7-linux-androideabi \
&& cargo install --locked cargo-ndk --version 4.1.2 \
&& rm -rf "$CARGO_HOME/registry"
FROM toolchain AS build
# Comma-separated Android ABIs: arm64-v8a, x86_64, armeabi-v7a.
ARG ABIS=arm64-v8a,x86_64
# debug (installable as is) or release (signed with the build secrets).
ARG APK=debug
WORKDIR /src
COPY . .
RUN --mount=type=cache,id=voelin-cargo-registry,target=/usr/local/cargo/registry \
--mount=type=cache,id=voelin-target-android,target=/src/target \
--mount=type=cache,id=voelin-gradle,target=/root/.gradle \
--mount=type=secret,id=keystore,required=false \
--mount=type=secret,id=signing,required=false \
set -e; \
if [ "$APK" = release ] && [ -f /run/secrets/keystore ]; then \
export VOELIN_SIGNING_STORE_FILE=/run/secrets/keystore; \
set -a; . /run/secrets/signing; set +a; \
fi; \
proxy="$(java-proxy-opts)"; \
export GRADLE_OPTS="$proxy"; \
task="assemble$(echo "$APK" | sed 's/./\U&/')"; \
(cd android && ./gradlew --no-daemon $proxy "$task" -Pvoelin.abis="$ABIS") \
&& scripts/package.sh android /out
FROM scratch AS artifacts
COPY --from=build /out /