-
Notifications
You must be signed in to change notification settings - Fork 24
/
Dockerfile
43 lines (35 loc) · 1.2 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
FROM openjdk:11
MAINTAINER Dmitry Karikh <[email protected]>
# Install Git and dependencies
RUN dpkg --add-architecture i386 \
&& apt-get update \
&& apt-get install -y file git curl zip libncurses5:i386 libstdc++6:i386 zlib1g:i386 jq \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists /var/cache/apt
# Set up environment variables
ENV ANDROID_SDK_ROOT="/home/user/android-sdk-linux" \
SDK_URL="https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip" \
GRADLE_URL="https://services.gradle.org/distributions/gradle-7.5.1-bin.zip"
# Create a non-root user
RUN useradd -m user
USER user
WORKDIR /home/user
# Download Android SDK
RUN mkdir "$ANDROID_SDK_ROOT" .android \
&& cd "$ANDROID_SDK_ROOT" \
&& mkdir cmdline-tools \
&& cd cmdline-tools \
&& curl -o sdk.zip $SDK_URL \
&& unzip sdk.zip \
&& rm sdk.zip \
&& mv cmdline-tools latest \
&& cd .. \
&& yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses
# Install Gradle
RUN wget $GRADLE_URL -O gradle.zip \
&& unzip gradle.zip \
&& mv gradle-7.5.1 gradle \
&& rm gradle.zip \
&& mkdir .gradle
ENV PATH="/home/user/gradle/bin:${ANDROID_SDK_ROOT}/platform-tools:${PATH}"
ENTRYPOINT ["/bin/bash"]