infra/stacks/android-emulator/docker/Dockerfile
Viktor Barzin 85dbec6108
Some checks failed
ci/woodpecker/push/build-cli Pipeline was successful
ci/woodpecker/push/default Pipeline failed
android-emulator: api36-v3 — avdmanager must run from inside the SDK root
v2's marker fix proved the install completes, but avdmanager still saw
no system images: it IGNORES ANDROID_SDK_ROOT (and has no --sdk_root),
deriving the SDK root from its own toolsdir — /opt/android in our image,
while packages live on the PVC at /sdk. v3 seeds cmdline-tools into
/sdk/cmdline-tools/latest once and runs avdmanager from there, so it
resolves the PVC as the SDK root.
2026-06-11 21:15:50 +00:00

43 lines
2 KiB
Docker

# Android emulator runner — slim on purpose: the SDK proper (platform-tools,
# emulator, system image, AVD) lives on the stack's PVC and is installed by
# entrypoint.sh on first boot, so this image carries only the JDK,
# cmdline-tools and the native libraries the emulator needs at runtime.
#
# Rebuild + push (rare — only when tool/library versions bump):
# docker build -t forgejo.viktorbarzin.me/viktor/android-emulator:api36-v3 .
# docker push forgejo.viktorbarzin.me/viktor/android-emulator:api36-v3
FROM eclipse-temurin:17-jdk-jammy
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
# emulator runtime deps (Qt window into Xvfb)
libpulse0 libgl1 libglu1-mesa libnss3 libasound2 libfontconfig1 \
libx11-6 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 \
libxfixes3 libxi6 libxrandr2 libxrender1 libxtst6 libxkbcommon0 \
libxkbfile1 libsm6 libice6 libdbus-1-3 \
# virtual display + browser viewing
xvfb x11vnc novnc websockify openbox \
# adb TCP forwarding + fetch tooling
socat wget unzip ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Android cmdline-tools (sdkmanager/avdmanager). Pinned; SDK packages they
# install land on the PVC at /sdk, not in this image.
ARG CMDLINE_TOOLS_VERSION=13114758
RUN mkdir -p /opt/android/cmdline-tools && \
wget -q "https://dl.google.com/android/repository/commandlinetools-linux-${CMDLINE_TOOLS_VERSION}_latest.zip" -O /tmp/clt.zip && \
unzip -q /tmp/clt.zip -d /opt/android/cmdline-tools && \
mv /opt/android/cmdline-tools/cmdline-tools /opt/android/cmdline-tools/latest && \
rm /tmp/clt.zip
ENV ANDROID_SDK_ROOT=/sdk \
ANDROID_USER_HOME=/sdk/.android \
ANDROID_AVD_HOME=/sdk/.android/avd \
PATH="/opt/android/cmdline-tools/latest/bin:/sdk/platform-tools:/sdk/emulator:${PATH}"
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# 5555 adb (socat → emulator adbd), 6080 noVNC web UI
EXPOSE 5555 6080
ENTRYPOINT ["/entrypoint.sh"]