-
Notifications
You must be signed in to change notification settings - Fork 16
/
Dockerfile
63 lines (50 loc) · 2.16 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
# fork of Dockerfile at https://github.com/not-fl3/cargo-quad-apk, testing for aarch64-linux-android
FROM archlinux
RUN pacman -Syu --noconfirm
RUN pacman -S --noconfirm jdk17-openjdk unzip wget cmake rustup openssl pkgconf gradle kotlin clang llvm lld gcc
# github override HOME, so here we are
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
RUN rustup toolchain install 1.77.0
RUN rustup default 1.77
RUN rustc --version
RUN rustup target add armv7-linux-androideabi
RUN rustup target add aarch64-linux-android
RUN rustup target add i686-linux-android
RUN rustup target add x86_64-linux-android
# Install Android SDK
ENV ANDROID_HOME /opt/android-sdk-linux
ENV JAVA_HOME /usr/lib/jvm/default
RUN mkdir ${ANDROID_HOME} && \
cd ${ANDROID_HOME} && \
wget -q https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip && \
unzip -q sdk-tools-linux-4333796.zip && \
rm sdk-tools-linux-4333796.zip && \
chown -R root:root /opt
RUN mkdir -p ~/.android && touch ~/.android/repositories.cfg
RUN yes | ${ANDROID_HOME}/tools/bin/sdkmanager "platform-tools" | grep -v = || true
RUN yes | ${ANDROID_HOME}/tools/bin/sdkmanager "platforms;android-31" | grep -v = || true
RUN yes | ${ANDROID_HOME}/tools/bin/sdkmanager "build-tools;31.0.0" | grep -v = || true
RUN ${ANDROID_HOME}/tools/bin/sdkmanager --update | grep -v = || true
# Install Android NDK
RUN cd /usr/local && \
wget -q http://dl.google.com/android/repository/android-ndk-r25-linux.zip && \
unzip -q android-ndk-r25-linux.zip && \
rm android-ndk-r25-linux.zip
ENV NDK_HOME /usr/local/android-ndk-r25
# Make directory for user code
RUN mkdir /root/src
# Copy contents to container. Should only use this on a clean directory
COPY . /root/src/
# Install mobile build
RUN cargo install --git https://github.com/tauri-apps/cargo-mobile2
# Add build-tools to PATH, for apksigner
ENV PATH="/opt/android-sdk-linux/build-tools/31.0.0/:${PATH}"
WORKDIR /root/src
# need to somehow agree to android licenses maybe below
# RUN yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses
#
# Then run
# RUN cargo mobile init
# RUN cargo mobile android apk build aarch64