wkplhc commited on
Commit
a8d297d
·
verified ·
1 Parent(s): 43c4f52

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +82 -0
Dockerfile ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM openjdk:18-jdk-slim
2
+
3
+ ENV DEBIAN_FRONTEND noninteractive
4
+
5
+ #WORKDIR /
6
+ #=============================
7
+ # Install Dependenices
8
+ #=============================
9
+ SHELL ["/bin/bash", "-c"]
10
+
11
+ RUN apt update && apt install -y curl \
12
+ sudo wget unzip bzip2 libdrm-dev \
13
+ libxkbcommon-dev libgbm-dev libasound-dev libnss3 \
14
+ libxcursor1 libpulse-dev libxshmfence-dev \
15
+ xauth xvfb x11vnc fluxbox wmctrl libdbus-glib-1-2 socat \
16
+ virt-manager
17
+
18
+
19
+ # Docker labels.
20
+ LABEL maintainer "Halim Qarroum <hqm.post@gmail.com>"
21
+ LABEL description "A Docker image allowing to run an Android emulator"
22
+ LABEL version "1.0.0"
23
+
24
+
25
+ # Arguments that can be overriden at build-time.
26
+ ARG INSTALL_ANDROID_SDK=1
27
+ ARG API_LEVEL=33
28
+ ARG IMG_TYPE=google_apis
29
+ ARG ARCHITECTURE=x86_64
30
+ ARG CMD_LINE_VERSION=9477386_latest
31
+ ARG DEVICE_ID=pixel
32
+ ARG GPU_ACCELERATED=false
33
+
34
+ # Environment variables.
35
+ ENV ANDROID_SDK_ROOT=/opt/android \
36
+ ANDROID_PLATFORM_VERSION="platforms;android-$API_LEVEL" \
37
+ PACKAGE_PATH="system-images;android-${API_LEVEL};${IMG_TYPE};${ARCHITECTURE}" \
38
+ API_LEVEL=$API_LEVEL \
39
+ DEVICE_ID=$DEVICE_ID \
40
+ ARCHITECTURE=$ARCHITECTURE \
41
+ ABI=${IMG_TYPE}/${ARCHITECTURE} \
42
+ GPU_ACCELERATED=$GPU_ACCELERATED \
43
+ QTWEBENGINE_DISABLE_SANDBOX=1 \
44
+ ANDROID_EMULATOR_WAIT_TIME_BEFORE_KILL=10 \
45
+ ANDROID_AVD_HOME=/data
46
+
47
+ # Exporting environment variables to keep in the path
48
+ # Android SDK binaries and shared libraries.
49
+ ENV PATH "${PATH}:${ANDROID_SDK_ROOT}/platform-tools"
50
+ ENV PATH "${PATH}:${ANDROID_SDK_ROOT}/emulator"
51
+ ENV PATH "${PATH}:${ANDROID_SDK_ROOT}/cmdline-tools/tools/bin"
52
+ ENV LD_LIBRARY_PATH "$ANDROID_SDK_ROOT/emulator/lib64:$ANDROID_SDK_ROOT/emulator/lib64/qt/lib"
53
+
54
+ # Set the working directory to /opt
55
+ WORKDIR /opt
56
+
57
+ # Exposing the Android emulator console port
58
+ # and the ADB port.
59
+ EXPOSE 5554 5555
60
+
61
+ # Initializing the required directories.
62
+ RUN mkdir /root/.android/ && \
63
+ touch /root/.android/repositories.cfg && \
64
+ mkdir /data
65
+
66
+ # Exporting ADB keys.
67
+ COPY keys/* /root/.android/
68
+
69
+ # The following layers will download the Android command-line tools
70
+ # to install the Android SDK, emulator and system images.
71
+ # It will then install the Android SDK and emulator.
72
+ COPY scripts/install-sdk.sh /opt/
73
+ RUN chmod +x /opt/install-sdk.sh
74
+ RUN /opt/install-sdk.sh
75
+
76
+ # Copy the container scripts in the image.
77
+ COPY scripts/start-emulator.sh /opt/
78
+ COPY scripts/emulator-monitoring.sh /opt/
79
+ RUN chmod +x /opt/*.sh
80
+
81
+ # Set the entrypoint
82
+ ENTRYPOINT ["/opt/start-emulator.sh"]