Last active
May 28, 2023 01:07
-
-
Save philipproplesch/2f500ecfec13c350734f4aef88922f24 to your computer and use it in GitHub Desktop.
Android SDK + Flutter via Docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:latest | |
ARG USER=developer | |
ARG ANDROID_COMMANDLINETOOLS_URL=https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip | |
ARG ANDROID_BUILD_TOOLS_VERSION=33.0.0 | |
ARG ANDROID_VERSION=30 | |
ARG FLUTTER_URL=https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_3.10.2-stable.tar.xz | |
# Install dependencies | |
RUN apt update \ | |
&& DEBIAN_FRONTEND=noninteractive apt install --yes --no-install-recommends ca-certificates curl default-jdk git unzip xz-utils zip \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Create user | |
RUN useradd -ms /bin/bash $USER | |
USER $USER | |
WORKDIR /home/$USER | |
# Install Android SDK | |
ENV ANDROID_HOME "/home/$USER/android" | |
ENV PATH "$PATH:/home/$USER/android/cmdline-tools/latest/bin:/home/$USER/flutter/bin" | |
RUN mkdir -p android/cmdline-tools \ | |
&& curl $ANDROID_COMMANDLINETOOLS_URL -L -o commandlinetools.zip \ | |
&& unzip commandlinetools.zip -d android/cmdline-tools \ | |
&& rm commandlinetools.zip \ | |
&& mv android/cmdline-tools/cmdline-tools android/cmdline-tools/latest \ | |
&& yes | android/cmdline-tools/latest/bin/sdkmanager --licenses \ | |
&& yes | android/cmdline-tools/latest/bin/sdkmanager "build-tools;$ANDROID_BUILD_TOOLS_VERSION" \ | |
&& yes | android/cmdline-tools/latest/bin/sdkmanager "platforms;android-$ANDROID_VERSION" \ | |
&& yes | android/cmdline-tools/latest/bin/sdkmanager "platform-tools" | |
# Install Flutter | |
RUN curl $FLUTTER_URL -L -o flutter.tar.xz \ | |
&& tar xf flutter.tar.xz \ | |
&& rm flutter.tar.xz \ | |
&& /home/$USER/flutter/bin/flutter precache \ | |
&& /home/$USER/flutter/bin/flutter doctor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment