-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (38 loc) · 1.24 KB
/
Copy pathDockerfile
File metadata and controls
48 lines (38 loc) · 1.24 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
43
44
45
46
47
# Use official openjdk base image to build android apps
FROM openjdk:17-jdk
# Install dependencies
RUN apt-get update && apt-get install -y \
curl \
unzip \
git \
bash \
lib32stdc++6 \
lib32z1 \
lib32ncurses5 \
lib32gcc1 \
libc6-dev-i386 \
lib32ncurses6 \
&& rm -rf /var/lib/apt/lists/*
# Install Android SDK
RUN mkdir /sdk
WORKDIR /sdk
RUN curl -sS https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip -o tools.zip
RUN unzip tools.zip
RUN rm tools.zip
# Set environment variables
ENV ANDROID_SDK_ROOT /sdk
ENV PATH $PATH:$ANDROID_SDK_ROOT/cmdline-tools/latest/bin
# Install required SDK packages (you can add more as needed)
RUN yes | sdkmanager --sdk_root=$ANDROID_SDK_ROOT --licenses
RUN sdkmanager --sdk_root=$ANDROID_SDK_ROOT "platform-tools" "build-tools;30.0.3" "platforms;android-30" "tools"
# Set up working directory for your project
WORKDIR /app
# Copy your Android project to the container
COPY . /app
# Install Gradle (if needed)
RUN curl -sS https://services.gradle.org/distributions/gradle-7.0.2-bin.zip -o gradle.zip
RUN unzip gradle.zip -d /opt
RUN rm gradle.zip
ENV PATH="/opt/gradle-7.0.2/bin:${PATH}"
# Build the APK (or SDK)
CMD ["./gradlew", "assembleDebug"]