1FROM ubuntu:14.04
2ARG userid
3ARG groupid
4ARG username
5
6RUN apt-get update && apt-get install -y git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip python openjdk-7-jdk
7
8RUN curl -o jdk8.tgz https://android.googlesource.com/platform/prebuilts/jdk/jdk8/+archive/master.tar.gz \
9 && tar -zxf jdk8.tgz linux-x86 \
10 && mv linux-x86 /usr/lib/jvm/java-8-openjdk-amd64 \
11 && rm -rf jdk8.tgz
12
13RUN curl -o /usr/local/bin/repo https://storage.googleapis.com/git-repo-downloads/repo \
14 && echo "d06f33115aea44e583c8669375b35aad397176a411de3461897444d247b6c220  /usr/local/bin/repo" | sha256sum --strict -c - \
15 && chmod a+x /usr/local/bin/repo
16
17RUN groupadd -g $groupid $username \
18 && useradd -m -u $userid -g $groupid $username \
19 && echo $username >/root/username \
20 && echo "export USER="$username >>/home/$username/.gitconfig
21COPY gitconfig /home/$username/.gitconfig
22RUN chown $userid:$groupid /home/$username/.gitconfig
23ENV HOME=/home/$username
24ENV USER=$username
25
26ENTRYPOINT chroot --userspec=$(cat /root/username):$(cat /root/username) / /bin/bash -i
27