Files
fuelish/build-image/Dockerfile
T
ml d5f4381169
build / build (push) Failing after 0s
Add a custom Android CI/release build image and packaging scripts
- build-image/: Dockerfile bundling JDK 17, the Android SDK, and
  Node.js (needed by Gitea's JS-based actions) - the app has no
  native code, so no NDK
- build-image.sh/upload-image.sh: extended to also build/push this
  image alongside the existing OCR pipeline tools image
- run-image.sh: runs `make android` inside the image against a live
  checkout, for a CI-equivalent local build
- Makefile: `make android` builds and versions a release APK into
  dist/, from the current git tag
- .gitea/workflows/build.yml: now pulls the custom image and just
  runs `make android`, replacing the ad-hoc Node/SDK install steps
- README.md: describes the pipeline, server, app, and build tooling
- registry.env.example: fix REGISTRY_IMAGE to be fully-qualified
  (an unqualified name was silently resolving pushes to Docker Hub
  instead of the configured registry)
2026-09-29 17:48:02 +02:00

74 lines
3.6 KiB
Docker

# Build environment for the Android app (android/): JDK + Android SDK
# cmdline-tools, pinned to the versions validated on the maintainer's dev
# machine (matching android/app/build.gradle.kts's compileSdk). Used both
# by .gitea/workflows/build.yml's CI container and by ../run-image.sh for
# a local, CI-equivalent build. Rebuild with ../build-image.sh whenever a
# version below changes.
#
# fuelish's Android app has no native/NDK code, so unlike a build image
# that also needs an NDK/CMake toolchain, this is just a JDK + the SDK's
# own cmdline-tools/platform/build-tools.
#
# Does NOT contain any secrets - registry/SFTP credentials are injected
# at job runtime from Gitea Actions secrets, never baked into this image.
FROM ubuntu:24.04
ARG NODE_VERSION=24.16.0
ARG ANDROID_CMDLINE_TOOLS_VERSION=9862592
ARG ANDROID_PLATFORM_VERSION=36
ARG ANDROID_BUILD_TOOLS_VERSION=36.0.0
ENV DEBIAN_FRONTEND=noninteractive
# openjdk-17-jdk-headless: Gradle/AGP's own minimum JDK (see
# android/app/build.gradle.kts's compileOptions).
# make: the root Makefile's `android` target (run by both run-image.sh
# and .gitea/workflows/build.yml).
# python3/python3-pil: android/scripts/gen_app_icons.py's Pillow
# dependency (see android/app/build.gradle.kts's generateAppIcons
# preBuild task) - apt's python3-pil is used instead of pip/venv since
# nothing else in this image needs a Python environment.
# git/curl/ca-certificates/unzip/xz-utils: checkout and SDK/Node tool
# downloads (xz-utils: Node's release tarball below is .tar.xz).
# openssh-client: the build workflow's `sftp` publish to dl.ladkau.de.
RUN apt-get update && apt-get install -y --no-install-recommends \
openjdk-17-jdk-headless make python3 python3-pil \
git curl ca-certificates unzip xz-utils openssh-client \
&& rm -rf /var/lib/apt/lists/*
# Node.js: actions/checkout@v4 and actions/upload-artifact@v3 (used by
# .gitea/workflows/build.yml) are both JS actions - Gitea's act_runner
# execs them with whatever `node` is on this image's PATH rather than
# injecting one itself (https://github.com/nektos/act/issues/107), and
# this base image doesn't bring one.
RUN curl -sSL -o /tmp/node.tar.xz \
"https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz" \
&& tar -xJf /tmp/node.tar.xz -C /usr/local --strip-components=1 \
&& rm /tmp/node.tar.xz
# Android SDK: the cmdline-tools' own sdkmanager installs exactly the
# platform/build-tools version android/app/build.gradle.kts pins -
# resolved here so no `docker run` of this image needs network access to
# install anything before `./gradlew assembleDebug` works. The Gradle
# build itself still needs network access at build time (Gradle/AGP/
# androidx dependency resolution against Google's Maven + Maven Central) -
# android/gradlew resolves its own pinned Gradle version, no Gradle
# binary is baked into this image.
ENV ANDROID_HOME=/opt/android-sdk \
ANDROID_SDK_ROOT=/opt/android-sdk
ENV PATH=${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${PATH}
RUN mkdir -p "${ANDROID_HOME}/cmdline-tools" \
&& curl -sSL -o /tmp/cmdline-tools.zip \
"https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_CMDLINE_TOOLS_VERSION}_latest.zip" \
&& unzip -q /tmp/cmdline-tools.zip -d "${ANDROID_HOME}/cmdline-tools" \
&& mv "${ANDROID_HOME}/cmdline-tools/cmdline-tools" "${ANDROID_HOME}/cmdline-tools/latest" \
&& rm /tmp/cmdline-tools.zip \
&& yes | sdkmanager --licenses >/dev/null \
&& sdkmanager --install \
"platform-tools" \
"platforms;android-${ANDROID_PLATFORM_VERSION}" \
"build-tools;${ANDROID_BUILD_TOOLS_VERSION}"
WORKDIR /workspace