-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathDockerfile
78 lines (64 loc) · 2.58 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
FROM --platform=linux/amd64 ubuntu:24.04
LABEL maintainer="messeb"
# Command line tools only
# https://developer.android.com/studio/index.html
ENV ANDROID_SDK_TOOLS_VERSION 11076708
ENV ANDROID_SDK_TOOLS_CHECKSUM 2d2d50857e4eb553af5a6dc3ad507a17adf43d115264b1afc116f95c92e5e258
ENV GRADLE_VERSION 8.3
ENV ANDROID_HOME "/opt/android-sdk-linux"
ENV ANDROID_SDK_ROOT $ANDROID_HOME
ENV PATH $PATH:$ANDROID_HOME/cmdline-tools:$ANDROID_HOME/cmdline-tools/bin:$ANDROID_HOME/platform-tools
ENV DEBIAN_FRONTEND=noninteractive
ENV LANG en_US.UTF-8
# Add base environment
RUN apt-get -qq update \
&& apt-get -qqy --no-install-recommends install \
apt-utils \
build-essential \
openjdk-17-jdk \
openjdk-17-jre-headless \
software-properties-common \
libssl-dev \
libffi-dev \
python3-dev \
cargo \
pkg-config\
libstdc++6 \
libpulse0 \
libglu1-mesa \
openssh-server \
zip \
unzip \
curl \
lldb \
git > /dev/null \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Download and unzip Android SDK Tools
RUN curl -s https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS_VERSION}_latest.zip > /tools.zip \
&& echo "$ANDROID_SDK_TOOLS_CHECKSUM ./tools.zip" | sha256sum -c \
&& unzip -qq /tools.zip -d $ANDROID_HOME \
&& rm -v /tools.zip
# Accept licenses
RUN mkdir -p $ANDROID_HOME/licenses/ \
&& echo "8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > $ANDROID_HOME/licenses/android-sdk-license \
&& echo "84831b9409646a918e30573bab4c9c91346d8abd\n504667f4c0de7af1a06de9f4b1727b84351f2910" > $ANDROID_HOME/licenses/android-sdk-preview-license --licenses \
&& yes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --licenses --sdk_root=${ANDROID_SDK_ROOT}
# Add folder for SDK files
RUN mkdir -p /home/mobiledevops/.android \
&& mkdir -p /home/mobiledevops/app \
&& touch /home/mobiledevops/.android/repositories.cfg
ENV HOME /home/mobiledevops
WORKDIR $HOME/app
# Install SDKMAN
RUN curl -s "https://get.sdkman.io" | bash
SHELL ["/bin/bash", "-c"]
# Install Android packages
ADD packages.txt $HOME
# Update sdkmanager
RUN $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=${ANDROID_SDK_ROOT} --update \
&& while read -r pkg; do PKGS="${PKGS}${pkg} "; done < $HOME/packages.txt \
&& $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=${ANDROID_SDK_ROOT} $PKGS \
&& rm $HOME/packages.txt
# Install Gradle
RUN source "${HOME}/.sdkman/bin/sdkman-init.sh" \
&& sdk install gradle ${GRADLE_VERSION}