-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
52 lines (43 loc) · 2.04 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
FROM ubuntu:20.04
LABEL maintainer="David Sn <divad.nnamtdeis@gmail.com>"
ENV DEBIAN_FRONTEND=noninteractive \
USER=docker \
USE_CCACHE=1 \
CCACHE_DIR=/tmp/ccache \
CCACHE_EXEC=/usr/bin/ccache
# Install required dependencies
RUN apt-get update && \
apt-get install --no-install-recommends -y \
adb autoconf automake axel bc bison build-essential \
ccache clang cmake expat fastboot flex g++ \
g++-multilib gawk gcc gcc-multilib git gnupg gperf \
htop imagemagick lib32ncurses5-dev lib32z1-dev libtinfo5 libc6-dev libcap-dev \
libexpat1-dev libgmp-dev '^liblz4-.*' '^liblzma.*' libmpc-dev libmpfr-dev libncurses5-dev \
libsdl1.2-dev libssl-dev libtool libxml2 libxml2-utils '^lzma.*' lzop \
maven ncftp ncurses-dev patch patchelf pkg-config pngcrush \
pngquant python2.7 python-all-dev re2c schedtool squashfs-tools subversion \
texinfo unzip w3m xsltproc zip zlib1g-dev lzip \
libxml-simple-perl apt-utils \
libncurses5 curl python-is-python3 sudo ssh rsync && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install repo binary (thanks akheel)
RUN curl --create-dirs -L -o /usr/local/bin/repo -O -L https://github.com/akhilnarang/repo/raw/master/repo && \
chmod a+x /usr/local/bin/repo
# Create seperate build user
RUN groupadd -g 1000 -r ${USER} && \
useradd -u 1000 --create-home -r -g ${USER} ${USER} && \
mkdir -p /tmp/ccache /repo && \
chown -R ${USER}: /tmp/ccache /repo
# Allow sudo without password for build user
RUN echo "${USER} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-docker-build && \
usermod -aG sudo ${USER}
# Setup volumes for persistent data
USER ${USER}
VOLUME ["/tmp/ccache", "/repo"]
# Create gitconfig for build user
RUN git config --global user.name ${USER} && git config --global user.email ${USER}@${HOSTNAME}.local && \
git config --global color.ui auto
# Work in the build directory, repo is expected to be init'd here
WORKDIR /repo
# This is where the magic happens~
ENTRYPOINT ["/bin/bash"]