infra/stacks/android-emulator/docker/Dockerfile
Viktor Barzin 577267cd97 android-emulator: api36-v4 — pin emulator 36.1.9; bind socat to pod IP
Two final fixes from the live debugging session: (1) sdkmanager-latest
emulator 36.6.11 hangs before executing a single guest instruction in
this pod (KVM and TCG alike, every gpu mode, crash-reporting on or off)
while 36.1.9 boots Android in ~107s — the entrypoint now pins build
13823996 on the PVC; (2) the emulator already listens on 127.0.0.1:5555,
so socat's wildcard bind died with EADDRINUSE and its exit restarted the
pod right after a successful boot — socat now binds the pod IP only.
2026-06-11 22:52:54 +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-v4 .
# docker push forgejo.viktorbarzin.me/viktor/android-emulator:api36-v4
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"]