Skip to content

Instantly share code, notes, and snippets.

@biwin
Forked from balachandarlinks/Dockerfile
Last active January 15, 2019 16:36
Show Gist options
  • Save biwin/633fbc2bc96d7138f6bedc49aa810bb4 to your computer and use it in GitHub Desktop.
Save biwin/633fbc2bc96d7138f6bedc49aa810bb4 to your computer and use it in GitHub Desktop.
Dockerfile for https://github.com/gojuno/mainframer remote android build system.
FROM ubuntu:18.04
MAINTAINER Biwin John KM "[email protected]"
ENV TZ=Europe/Minsk
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# Install java8
RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository -y ppa:webupd8team/java && \
(echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | /usr/bin/debconf-set-selections) && \
apt-get update && \
apt-get install -y oracle-java8-installer && \
apt-get clean && \
rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install Deps
RUN dpkg --add-architecture i386 && apt-get update && apt-get install -y expect unzip git wget apt-utils libc6-i386 lib32stdc++6 lib32gcc1 lib32ncurses5 lib32z1 python curl libqt5widgets5 && apt-get clean && rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Copy install tools
RUN cd /opt && mkdir tools
# COPY tools /opt/tools
ENV PATH ${PATH}:/opt/tools
# Install Android SDK
# RUN cd /opt && wget --output-document=android-sdk.tgz --quiet https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz && \
# tar xzf android-sdk.tgz && \
# rm -f android-sdk.tgz && \
# chown -R root.root android-sdk-linux && \
# /opt/tools/android-accept-licenses.sh "android-sdk-linux/tools/android update sdk --all --no-ui --filter platform-tools,tools" && \
# /opt/tools/android-accept-licenses.sh "android-sdk-linux/tools/android update sdk --all --no-ui --filter platform-tools,tools,build-tools-25.0.1,android-25,addon-google_apis_x86-google-21,extra-android-support,extra-android-m2repository,extra-google-m2repository,extra-google-google_play_services"
# Install Android SDK
# RUN cd /opt && wget --output-document=android-sdk.tgz --quiet https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz && \
# tar xzf android-sdk.tgz && \
# rm -f android-sdk.tgz && \
# chown -R root.root android-sdk-linux && \
# /opt/tools/android-accept-licenses.sh "android-sdk-linux/tools/android update sdk --all --no-ui --filter platform-tools,tools" && \
# /opt/tools/android-accept-licenses.sh "android-sdk-linux/tools/android update sdk --all --no-ui --filter platform-tools,tools,build-tools-25.0.1,android-25,addon-google_apis_x86-google-21,extra-android-support,extra-android-m2repository,extra-google-m2repository,extra-google-google_play_services"
# RUN cd /opt && wget --output-document=android.sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip && \
# unzip android.sdk.zip && rm -rf android.sdk.zip
RUN apt-get update && apt-get install -y wget unzip
RUN cd /opt && wget -nv --output-document=android-sdk.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip && \
unzip -q android-sdk.zip && rm -rf android-sdk.zip && \
mkdir ~/.android && \
touch ~/.android/repositories.cfg && \
ln -s /opt/tools/bin/sdkmanager /usr/bin/sdkmanager && \
sdkmanager --update && \
# echo "y" | sdkmanager "build-tools;28.0.3" "platform-tools" "platforms;android-28" "platforms;android-22" "extras;android;m2repository" "extras;google;m2repository" "extras;google;google_play_services"
echo "y" | sdkmanager "build-tools;28.0.3" "platform-tools" "platforms;android-28" "extras;android;m2repository" "extras;google;m2repository" "extras;google;google_play_services"
# ln -s /opt/foo /usr/bin/sdkmanager
# Setup environment variables
ENV JAVA8_HOME /usr/lib/jvm/java-8-oracle
ENV ANDROID_HOME /opt/android-sdk-linux
ENV PATH ${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
RUN echo "export JAVA_HOME=$JAVA8_HOME" | cat - ~/.bashrc >> temp && mv temp ~/.bashrc && \
echo "export JAVA8_HOME=$JAVA8_HOME" | cat - ~/.bashrc >> temp && mv temp ~/.bashrc && \
echo "export ANDROID_HOME=$ANDROID_HOME" | cat - ~/.bashrc >> temp && mv temp ~/.bashrc
# Setup ssh server
RUN apt-get update && \
apt-get install -y openssh-server && \
mkdir /var/run/sshd && \
echo 'root:root' |chpasswd && \
sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config && \
sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
EXPOSE 2222
CMD ["/usr/sbin/sshd", "-D"]
# Cleaning
RUN apt-get clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment