-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from HQarroum/feature/gpu
Feature/gpu
- Loading branch information
Showing
6 changed files
with
132 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
FROM nvidia/cuda:12.1.0-runtime-ubuntu22.04 | ||
|
||
# Docker labels. | ||
LABEL maintainer "Halim Qarroum <[email protected]>" | ||
LABEL description "A Docker image allowing to run an Android emulator" | ||
LABEL version "1.1.0" | ||
|
||
# `redir.c` will be used to redirect | ||
# localhost ADB ports to the container interface. | ||
COPY deps/redir/redir.c /usr/src/redir.c | ||
|
||
# Installing required packages. | ||
RUN apt update -y && \ | ||
apt install -y --no-install-recommends \ | ||
build-essential \ | ||
bash \ | ||
unzip \ | ||
wget \ | ||
libvirt-daemon \ | ||
dbus \ | ||
openjdk-11-jdk \ | ||
ca-certificates-java \ | ||
virt-manager \ | ||
libvulkan1 \ | ||
xvfb \ | ||
libgl1-mesa-glx \ | ||
libgl1-mesa-dri \ | ||
iproute2 && \ | ||
# Compile `redir`. | ||
gcc /usr/src/redir.c -o /usr/bin/redir && \ | ||
strip /usr/bin/redir && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# 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 | ||
ARG DEVICE_ID=pixel | ||
ARG GPU_ACCELERATED=true | ||
|
||
# Environment variables. | ||
ENV ANDROID_SDK_ROOT=/opt/android \ | ||
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 \ | ||
ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL=10 | ||
|
||
# Exporting environment variables for keeping in the path | ||
# 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/ && \ | ||
touch /root/.android/repositories.cfg | ||
|
||
# Exporting ADB keys. | ||
COPY keys/* /root/.android/ | ||
|
||
# Copy the startup scripts. | ||
COPY scripts/* /opt/ | ||
|
||
# Make the scripts executable. | ||
RUN chmod +x /opt/*.sh | ||
|
||
# This layer will download the Android command-line tools | ||
# to install the Android SDK, emulator and system images. | ||
# It will then install the Android SDK and emulator. | ||
RUN /opt/install-sdk.sh | ||
|
||
# Set the entrypoint | ||
ENTRYPOINT ["/opt/start-emulator.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters