#FROM gableroux/flutter
FROM debian:sid-slim

# Variables ámbito durante la ejecución del Dockerfile
ARG androidVersion=28
ARG urlflutter="https://storage.googleapis.com/flutter_infra/releases/stable/linux/flutter_linux_v1.9.1+hotfix.6-stable.tar.xz"
ARG flutter="flutter_linux_v1.9.1+hotfix.6-stable.tar.xz"
ARG urlSDKandroid="https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip"
ARG android="sdk-tools-linux-4333796.zip"


RUN mkdir -p /usr/share/man/man1 /usr/share/man/man5 /usr/share/man/man8
RUN apt update && apt -y upgrade && apt -y install git xz-utils curl unzip libglu1-mesa wget openjdk-8-jdk && apt clean

RUN wget -q $urlSDKandroid
RUN mkdir -p /opt/android_sdk
RUN unzip -q -d /opt/android_sdk $android
RUN yes "y" | "/opt/android_sdk/tools/bin/sdkmanager" "build-tools;$androidVersion.0.0"
RUN yes "y" | "/opt/android_sdk/tools/bin/sdkmanager" "platforms;android-$androidVersion"
RUN yes "y" | "/opt/android_sdk/tools/bin/sdkmanager" "platform-tools"
ENV PATH="/opt/android_sdk/tools:${PATH}"
ENV PATH="/opt/android_sdk/tools/bin:${PATH}"

RUN wget -q $urlflutter
RUN tar xf $flutter
ENV PATH="$PATH:/flutter/bin"
#RUN flutter precache
#RUN /tools/bin/sdkmanager
#RUN flutter doctor
