Created
April 1, 2020 16:20
-
-
Save blackshehz/c8cc0d28bf2ddc3b7fb7cb63de24ba12 to your computer and use it in GitHub Desktop.
Dockerfile for android sdk and flutter
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 debian:stretch | |
# image mostly inspired from https://github.com/GoogleCloudPlatform/cloud-builders-community/blob/770e0e9/flutter/Dockerfile | |
WORKDIR / | |
RUN apt-get update -y | |
RUN apt-get install -y --no-install-recommends \ | |
git \ | |
wget \ | |
curl \ | |
unzip \ | |
lcov \ | |
lib32stdc++6 \ | |
libglu1-mesa \ | |
default-jdk-headless | |
# Define Android Version here | |
ARG ANDROID_VERSION="28" | |
# Install the Android SDK Dependency. | |
ARG ANDROID_SDK_VERSION="4333796" | |
ARG ANDROID_SDK_URL="https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_VERSION}.zip" | |
ARG ANDROID_TOOLS_ROOT="/opt/android_sdk" | |
RUN mkdir -p "${ANDROID_TOOLS_ROOT}" | |
ARG ANDROID_SDK_ARCHIVE="${ANDROID_TOOLS_ROOT}/archive" | |
RUN wget -q "${ANDROID_SDK_URL}" -O "${ANDROID_SDK_ARCHIVE}" | |
RUN unzip -q -d "${ANDROID_TOOLS_ROOT}" "${ANDROID_SDK_ARCHIVE}" | |
RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "build-tools;${ANDROID_VERSION}.0.0" | |
RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "platforms;android-${ANDROID_VERSION}" | |
RUN yes "y" | "${ANDROID_TOOLS_ROOT}/tools/bin/sdkmanager" "platform-tools" | |
RUN rm "${ANDROID_SDK_ARCHIVE}" | |
ENV PATH="${ANDROID_TOOLS_ROOT}/tools:${PATH}" | |
ENV PATH="${ANDROID_TOOLS_ROOT}/tools/bin:${PATH}" | |
RUN apt-get install -y xz-utils | |
# Define Flutter Version here | |
ARG FLUTTER_VERSION="1.12.13+hotfix.8-stable" | |
# Install Flutter. | |
ARG FLUTTER_ROOT="/opt/flutter" | |
RUN mkdir -p "${FLUTTER_ROOT}" | |
ARG FLUTTER_ARCHIVE="${FLUTTER_ROOT}/archive" | |
ARG FLUTTER_URL="https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v${FLUTTER_VERSION}.tar.xz" | |
RUN wget -q "${FLUTTER_URL}" -O "${FLUTTER_ARCHIVE}" | |
RUN tar xf "${FLUTTER_ARCHIVE}" -C "${FLUTTER_ROOT}" | |
RUN rm "${FLUTTER_ARCHIVE}" | |
ENV PATH="${FLUTTER_ROOT}/bin:${PATH}" | |
# Define Andoid environment variables | |
ENV ANDROID_HOME="${ANDROID_TOOLS_ROOT}" | |
ENV ANDROID_SDK_ROOT="${ANDROID_HOME}" | |
ENV PATH="$PATH:${FLUTTER_ROOT}/flutter/bin/cache/dart-sdk/bin:${FLUTTER_ROOT}/flutter/bin" | |
# Accept licenses. | |
RUN yes "y" | flutter doctor --android-licenses | |
RUN flutter channel dev | |
# Disable analytics and crash reporting on the builder. | |
RUN flutter config --no-analytics | |
RUN flutter upgrade | |
# Perform a doctor run. | |
RUN flutter doctor -v | |
# Add python too | |
RUN apt-get install -y python3 --no-install-recommends | |
RUN ln -s $(which python3) /usr/bin/python | |
EXPOSE 8080 | |
CMD '/bin/bash' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment