fix(runner-android): bump JDK 17 -> 21 for Capacitor 7.6 (#3)

Capacitor 7.6.x's capacitor-android library compiles against Java 21 source level. JDK 17 fails javac with 'invalid source release: 21'. Bump the prebaked image to temurin-21-jdk.
This commit is contained in:
forgejo_admin 2026-05-17 16:42:24 +04:00
parent 35301c349b
commit 9208b3eacd

View file

@ -1,5 +1,5 @@
# Job container image for Android workflows. Inherits forgejo-stack/job:latest
# (Node 22 + yarn + Playwright stack) and adds JDK 17 + Android SDK so
# (Node 22 + yarn + Playwright stack) and adds JDK 21 + Android SDK so
# Capacitor / Gradle workflows skip the ~3-5 min SDK install on every run.
#
# Built locally by setup.sh and tagged forgejo-stack/job-android:latest.
@ -21,8 +21,11 @@ FROM forgejo-stack/job:latest
USER root
# JDK 17 (Temurin) via Eclipse Adoptium apt repo. Capacitor 7 / AGP 8+
# require JDK 17; JDK 21 also works but 17 is the LTS we standardise on.
# JDK 21 (Temurin) via Eclipse Adoptium apt repo. Capacitor 7.6.x's
# capacitor-android library compiles against Java 21 source level
# (`sourceCompatibility = VERSION_21`); JDK 17 errors out at the javac
# stage with `invalid source release: 21`. Verified on exifcleaner-web
# run #160 (the first dispatch after wiring up the prebaked image).
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
wget gnupg ca-certificates apt-transport-https \
@ -32,10 +35,10 @@ RUN apt-get update \
> /etc/apt/sources.list.d/adoptium.list \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
temurin-17-jdk unzip \
temurin-21-jdk unzip \
&& rm -rf /var/lib/apt/lists/*
ENV JAVA_HOME=/usr/lib/jvm/temurin-17-jdk-amd64
ENV JAVA_HOME=/usr/lib/jvm/temurin-21-jdk-amd64
ENV PATH=$JAVA_HOME/bin:$PATH
# Sanity check — fail the build if JDK isn't reachable.
@ -91,7 +94,7 @@ RUN sdkmanager --list_installed | grep -E "platforms;android-${ANDROID_API_LEVEL
# the image to a specific AGP version; not worth the maintenance burden.
# Document the toolchain versions baked in (handy for `docker inspect`).
LABEL org.metascrub.runner.jdk="17"
LABEL org.metascrub.runner.jdk="21"
LABEL org.metascrub.runner.android-api-level="35"
LABEL org.metascrub.runner.android-build-tools="35.0.0"
LABEL org.metascrub.runner.cmdline-tools="11076708"