-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathDockerfile
More file actions
81 lines (67 loc) · 2.71 KB
/
Dockerfile
File metadata and controls
81 lines (67 loc) · 2.71 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
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
79
80
81
FROM --platform=linux/amd64 debian:trixie
ENV DEBIAN_FRONTEND=noninteractive
ARG USERNAME="bull"
ENV USER=$USERNAME
ARG FVM_VERSION=4.0.5
ARG FLUTTER_VERSION=3.38.5
ARG ANDROID_CMDLINE_TOOLS_VERSION=14742923
# Android versions (passed via --build-arg from Makefile, defaults as fallback)
ARG JVM_TARGET=21
ARG ANDROID_API_LEVEL=36
ARG ANDROID_BUILD_TOOLS=36.0.0
ARG ANDROID_NDK=29.0.14206865
ARG RUST_VERSION=1.95.0
ENV ANDROID_HOME=/opt/android-sdk
ENV PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools
# Install dependencies
RUN apt-get update && apt-get install -y \
sudo \
ca-certificates \
curl \
git \
unzip \
xz-utils \
zip \
wget \
make \
openjdk-${JVM_TARGET}-jdk-headless \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Create user
RUN adduser --disabled-password --gecos '' $USER
RUN adduser $USER sudo
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER $USER
# Install Rust (pinned for reproducible builds; cargokit defaults to 'stable' for
# plugins without cargokit.yaml, so this version determines their output)
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --default-toolchain ${RUST_VERSION}
ENV PATH="/home/$USER/.cargo/bin:${PATH}"
# Add Android Rust targets
RUN rustup target add aarch64-linux-android
RUN rustup target add armv7-linux-androideabi
RUN rustup target add x86_64-linux-android
RUN rustup target add i686-linux-android
RUN rustc --version && cargo --version
# Install FVM
RUN curl -fsSL https://fvm.app/install.sh -o /tmp/fvm-install.sh
RUN bash /tmp/fvm-install.sh ${FVM_VERSION}
RUN rm /tmp/fvm-install.sh
ENV PATH="/home/$USER/fvm/bin:${PATH}"
# Install Flutter via FVM
RUN fvm install ${FLUTTER_VERSION}
RUN fvm global ${FLUTTER_VERSION}
ENV PATH="/home/$USER/fvm/default/bin:${PATH}"
# Download Android cmdline-tools
RUN sudo wget -q https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_CMDLINE_TOOLS_VERSION}_latest.zip -O /tmp/android-cmdline-tools.zip
# Set up Android SDK
RUN sudo mkdir -p ${ANDROID_HOME}/cmdline-tools
RUN sudo unzip -q /tmp/android-cmdline-tools.zip -d ${ANDROID_HOME}/cmdline-tools
RUN sudo mv ${ANDROID_HOME}/cmdline-tools/cmdline-tools ${ANDROID_HOME}/cmdline-tools/latest
RUN sudo rm /tmp/android-cmdline-tools.zip
RUN sudo chown -R $USER ${ANDROID_HOME}
# Install Android SDK components
RUN yes | sdkmanager --sdk_root=${ANDROID_HOME} --licenses
RUN sdkmanager --sdk_root=${ANDROID_HOME} "platform-tools"
RUN sdkmanager --sdk_root=${ANDROID_HOME} "platforms;android-${ANDROID_API_LEVEL}"
RUN sdkmanager --sdk_root=${ANDROID_HOME} "build-tools;${ANDROID_BUILD_TOOLS}"
RUN sdkmanager --sdk_root=${ANDROID_HOME} "ndk;${ANDROID_NDK}"