За основу берем Ubuntu 18.04, устанавливаем Android SDK, так же устанавливаем ruby, nodejs и yarn. И пробрасываем пользователя Jenkins в контейнер, для выполнения привилегированных команд.
Dockerfile:
FROM ubuntu:18.04 ENV ANDROID_SDK_HOME /opt/android-sdk-linux ENV ANDROID_SDK_ROOT /opt/android-sdk-linux ENV ANDROID_HOME /opt/android-sdk-linux ENV ANDROID_SDK /opt/android-sdk-linux ENV DEBIAN_FRONTEND noninteractive RUN dpkg --add-architecture i386 && apt update && apt install -y \ curl \ expect \ git \ make \ libc6:i386 \ libgcc1:i386 \ libncurses5:i386 \ libstdc++6:i386 \ zlib1g:i386 \ openjdk-8-jdk \ wget \ unzip \ vim \ openssh-client \ locales \ && apt-get clean RUN rm -rf /var/lib/apt/lists/* && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 ENV LANG en_US.UTF-8 RUN groupadd android && useradd -d /opt/android-sdk-linux -g android -u 1000 android COPY tools /opt/tools COPY licenses /opt/licenses WORKDIR /opt/android-sdk-linux RUN apt update && \ apt install -y sudo gnupg2 && \ curl -sL https://deb.nodesource.com/setup_8.x | bash - && \ curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ apt update && \ apt install -y build-essential gnupg2 ruby-full nodejs yarn && \ gem update --system && \ gem install bundle && \ echo "jenkins:x:106:111:Jenkins,,,:/home:/bin/bash" >> /etc/passwd && \ /opt/tools/entrypoint.sh built-in && \ chown -R jenkins /opt/android-sdk-linux && \ chown -R jenkins /home COPY sudoers /etc/sudoers COPY group /etc/group CMD /opt/tools/entrypoint.sh built-in