Skip to content

Instantly share code, notes, and snippets.

@pablodz
Created January 30, 2022 21:20
Show Gist options
  • Save pablodz/e562a164c1b870fbfee5afe5ed58c269 to your computer and use it in GitHub Desktop.
Save pablodz/e562a164c1b870fbfee5afe5ed58c269 to your computer and use it in GitHub Desktop.
Dockerfile to build in Flutter
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
# Prerequisites
RUN apt update && apt install -y \
curl \
wget \
git \
unzip \
xz-utils \
zip \
libglu1-mesa \
openjdk-8-jdk \
build-essential
# Setup new user
RUN useradd -ms /bin/bash developer
USER developer
WORKDIR /home/developer
# Prepare Android directories and system variables
RUN mkdir -p Android/Sdk
ENV ANDROID_SDK_ROOT /home/developer/Android/Sdk
RUN mkdir -p .android && touch .android/repositories.cfg
# Setup Android SDK [DEPRECATED]
RUN wget -O sdk-tools.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
RUN unzip sdk-tools.zip && rm sdk-tools.zip
RUN mv tools Android/Sdk/tools
RUN cd Android/Sdk/tools/bin && yes | ./sdkmanager --licenses
RUN cd Android/Sdk/tools/bin && ./sdkmanager "build-tools;29.0.2" "patcher;v4" "platform-tools" "platforms;android-29" "sources;android-29"
# Download Flutter SDK
RUN git clone https://github.com/flutter/flutter.git
ENV PATH "$PATH:/home/developer/flutter/bin"
# Run basic check to download Dark SDK
RUN flutter doctor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment