2026-05-06 14:32:56 +05:45
|
|
|
FROM eclipse-temurin:25
|
2024-02-20 17:06:32 +00:00
|
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND noninteractive
|
|
|
|
|
|
|
|
|
|
#WORKDIR /
|
|
|
|
|
#=============================
|
2024-04-23 21:30:37 +03:00
|
|
|
# Install Dependenices
|
2024-02-20 17:06:32 +00:00
|
|
|
#=============================
|
2024-04-23 21:30:37 +03:00
|
|
|
SHELL ["/bin/bash", "-c"]
|
2024-02-20 17:06:32 +00:00
|
|
|
|
|
|
|
|
RUN apt update && apt install -y curl \
|
|
|
|
|
sudo wget unzip bzip2 libdrm-dev \
|
|
|
|
|
libxkbcommon-dev libgbm-dev libasound-dev libnss3 \
|
|
|
|
|
libxcursor1 libpulse-dev libxshmfence-dev \
|
|
|
|
|
xauth xvfb x11vnc fluxbox wmctrl libdbus-glib-1-2 socat \
|
|
|
|
|
virt-manager
|
|
|
|
|
|
2023-02-15 03:01:51 +00:00
|
|
|
|
|
|
|
|
# Docker labels.
|
|
|
|
|
LABEL maintainer "Halim Qarroum <hqm.post@gmail.com>"
|
|
|
|
|
LABEL description "A Docker image allowing to run an Android emulator"
|
|
|
|
|
LABEL version "1.0.0"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Arguments that can be overriden at build-time.
|
|
|
|
|
ARG INSTALL_ANDROID_SDK=1
|
|
|
|
|
ARG API_LEVEL=33
|
|
|
|
|
ARG IMG_TYPE=google_apis
|
|
|
|
|
ARG ARCHITECTURE=x86_64
|
|
|
|
|
ARG CMD_LINE_VERSION=9477386_latest
|
2023-03-05 01:08:33 +00:00
|
|
|
ARG DEVICE_ID=pixel
|
2023-03-13 21:07:22 +00:00
|
|
|
ARG GPU_ACCELERATED=false
|
2023-02-15 03:01:51 +00:00
|
|
|
|
|
|
|
|
# Environment variables.
|
|
|
|
|
ENV ANDROID_SDK_ROOT=/opt/android \
|
2024-02-20 17:06:32 +00:00
|
|
|
ANDROID_PLATFORM_VERSION="platforms;android-$API_LEVEL" \
|
|
|
|
|
PACKAGE_PATH="system-images;android-${API_LEVEL};${IMG_TYPE};${ARCHITECTURE}" \
|
|
|
|
|
API_LEVEL=$API_LEVEL \
|
|
|
|
|
DEVICE_ID=$DEVICE_ID \
|
|
|
|
|
ARCHITECTURE=$ARCHITECTURE \
|
|
|
|
|
ABI=${IMG_TYPE}/${ARCHITECTURE} \
|
|
|
|
|
GPU_ACCELERATED=$GPU_ACCELERATED \
|
|
|
|
|
QTWEBENGINE_DISABLE_SANDBOX=1 \
|
2024-04-23 21:30:37 +03:00
|
|
|
ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL=10 \
|
|
|
|
|
ANDROID_AVD_HOME=/data
|
2023-02-15 03:01:51 +00:00
|
|
|
|
2023-03-14 16:54:48 +00:00
|
|
|
# Exporting environment variables to keep in the path
|
2023-02-15 03:01:51 +00:00
|
|
|
# Android SDK binaries and shared libraries.
|
|
|
|
|
ENV PATH "${PATH}:${ANDROID_SDK_ROOT}/platform-tools"
|
|
|
|
|
ENV PATH "${PATH}:${ANDROID_SDK_ROOT}/emulator"
|
|
|
|
|
ENV PATH "${PATH}:${ANDROID_SDK_ROOT}/cmdline-tools/tools/bin"
|
|
|
|
|
ENV LD_LIBRARY_PATH "$ANDROID_SDK_ROOT/emulator/lib64:$ANDROID_SDK_ROOT/emulator/lib64/qt/lib"
|
|
|
|
|
|
|
|
|
|
# Set the working directory to /opt
|
|
|
|
|
WORKDIR /opt
|
|
|
|
|
|
|
|
|
|
# Exposing the Android emulator console port
|
|
|
|
|
# and the ADB port.
|
|
|
|
|
EXPOSE 5554 5555
|
|
|
|
|
|
|
|
|
|
# Initializing the required directories.
|
|
|
|
|
RUN mkdir /root/.android/ && \
|
2024-04-23 21:30:37 +03:00
|
|
|
touch /root/.android/repositories.cfg && \
|
|
|
|
|
mkdir /data
|
2023-02-15 03:01:51 +00:00
|
|
|
|
|
|
|
|
# Exporting ADB keys.
|
2024-04-24 13:08:32 +03:00
|
|
|
COPY keys/* /root/.android/
|
2023-02-15 03:01:51 +00:00
|
|
|
|
2023-03-14 16:54:48 +00:00
|
|
|
# The following layers will download the Android command-line tools
|
2023-02-15 03:01:51 +00:00
|
|
|
# to install the Android SDK, emulator and system images.
|
|
|
|
|
# It will then install the Android SDK and emulator.
|
2023-03-14 16:54:48 +00:00
|
|
|
COPY scripts/install-sdk.sh /opt/
|
|
|
|
|
RUN chmod +x /opt/install-sdk.sh
|
2023-02-15 03:01:51 +00:00
|
|
|
RUN /opt/install-sdk.sh
|
|
|
|
|
|
2023-03-14 16:54:48 +00:00
|
|
|
# Copy the container scripts in the image.
|
|
|
|
|
COPY scripts/start-emulator.sh /opt/
|
|
|
|
|
COPY scripts/emulator-monitoring.sh /opt/
|
|
|
|
|
RUN chmod +x /opt/*.sh
|
|
|
|
|
|
2023-02-15 03:01:51 +00:00
|
|
|
# Set the entrypoint
|
|
|
|
|
ENTRYPOINT ["/opt/start-emulator.sh"]
|