1
+ FROM codercom/enterprise-base:latest
2
+
3
+ ARG ANDROID_SDK_VERSION=13114758
4
+ ENV ANDROID_SDK_URL="https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_VERSION}_latest.zip"
5
+
6
+ USER root
7
+
8
+ # Java
9
+ RUN apt update --yes && \
10
+ apt install --yes --no-install-recommends \
11
+ openjdk-21-jdk \
12
+ openjdk-21-jre \
13
+ libpulse0 && \
14
+ rm -rf /var/lib/apt/lists/*
15
+
16
+ # TODO: Gradle
17
+
18
+ # Install the Android commandline tools
19
+ ENV ANDROID_HOME="/usr/local/android"
20
+ ENV CMDLINE_TOOLS_HOME="${ANDROID_HOME}/cmdline-tools"
21
+
22
+ RUN mkdir -p "$CMDLINE_TOOLS_HOME" && \
23
+ wget "$ANDROID_SDK_URL" -O "/tmp/android-sdk.zip" && \
24
+ unzip "/tmp/android-sdk.zip" -d "$CMDLINE_TOOLS_HOME" && \
25
+ mv "$CMDLINE_TOOLS_HOME/cmdline-tools" "$CMDLINE_TOOLS_HOME/latest" && \
26
+ rm -rf "/tmp/android-sdk.zip"
27
+
28
+ # Add the command line tools to the path
29
+ ENV PATH="${PATH}:${CMDLINE_TOOLS_HOME}/latest/bin"
30
+
31
+ # Accept sdkmanager licenses
32
+ RUN yes | sdkmanager --licenses
33
+
34
+ # Install required tools, TODO: see why CircleCI installs multiple versions of build-tools
35
+ RUN sdkmanager \
36
+ "tools" \
37
+ "platform-tools" \
38
+ "build-tools;34.0.0"
39
+
40
+ # Install Android and Google's Maven repositories and Google Play services
41
+ RUN sdkmanager \
42
+ "extras;android;m2repository" \
43
+ "extras;google;m2repository" \
44
+ "extras;google;google_play_services"
45
+
46
+ # Install Android platforms and system images
47
+ # TODO: see how we handle all the platforms and system images for all the different versions, also diff between google_apis and google_apis_playstore
48
+ RUN sdkmanager \
49
+ "platforms;android-34" \
50
+ "system-images;android-34;google_apis_playstore;x86_64"
51
+
52
+ # Make the Android SDK folder accessible by all users
53
+ RUN chmod 755 "$ANDROID_HOME" -R
54
+
55
+ # Add all the other Android SDK tools to the path
56
+ ENV PATH="${PATH}:${ANDROID_HOME}/emulator:${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools"
57
+
58
+ # Add the "coder" user to the "kvm" group to allow it to use the /dev/kvm device
59
+ RUN groupadd -r kvm -g 108 && \
60
+ usermod -aG kvm coder
61
+
62
+ USER coder
0 commit comments