-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (34 loc) · 1.61 KB
/
Dockerfile
File metadata and controls
42 lines (34 loc) · 1.61 KB
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
FROM eclipse-temurin:17-jdk
# Set environment variables
ENV ANDROID_HOME /opt/android-sdk
ENV PATH ${PATH}:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools
# Install necessary system packages
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
unzip \
git \
&& rm -rf /var/lib/apt/lists/*
# Download and install Android Command Line Tools
# Version: cmdline-tools;latest (checked from developer.android.com, typically part of commandlinetools-linux-*.zip)
# Using specific version suitable for stability.
# As of early 2024, cmdline-tools 11.0 is common, checking official link pattern.
# https://dl.google.com/android/repository/commandlinetools-linux-10406996_latest.zip is a recent one.
# We will use a reasonably recent valid URL.
ARG CMDLINE_TOOLS_URL=https://dl.google.com/android/repository/commandlinetools-linux-10406996_latest.zip
RUN mkdir -p ${ANDROID_HOME}/cmdline-tools \
&& curl -o cmdline-tools.zip ${CMDLINE_TOOLS_URL} \
&& unzip cmdline-tools.zip -d ${ANDROID_HOME}/cmdline-tools \
&& mv ${ANDROID_HOME}/cmdline-tools/cmdline-tools ${ANDROID_HOME}/cmdline-tools/latest \
&& rm cmdline-tools.zip
# Accept licenses
RUN yes | sdkmanager --licenses
# Install Gradle 8.2
RUN curl -L https://services.gradle.org/distributions/gradle-8.2-bin.zip -o gradle.zip \
&& unzip gradle.zip -d /opt \
&& rm gradle.zip \
&& mv /opt/gradle-8.2 /opt/gradle
ENV PATH ${PATH}:/opt/gradle/bin
# Install SDK packages
# Based on build.gradle: compileSdk 34, minSdk 24
RUN sdkmanager "platform-tools" "platforms;android-34" "build-tools;34.0.0"
WORKDIR /app