-
-
Notifications
You must be signed in to change notification settings - Fork 66
/
Dockerfile
64 lines (50 loc) · 2.29 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
53
54
55
56
57
58
59
60
61
62
63
64
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
LABEL maintainer="Roman Marchenko <[email protected]>"
ENV PATH="/home/user/bin:${PATH}"
# Taking into account layer structure, everything should be done within one layer.
RUN apt-get update && apt-get upgrade -y && \
# Install Google recommended packages ( https://source.android.com/setup/build/initializing#installing-required-packages-ubuntu-1804 )
apt-get install -y git-core gnupg flex bison build-essential zip \
curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev \
x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev \
libxml2-utils xsltproc unzip fontconfig \
# Install additional packages
swig libssl-dev flex bison device-tree-compiler mtools gettext libncurses5 libgmp-dev \
libmpc-dev cpio rsync dosfstools kmod gdisk wget lz4 git meson cmake libglib2.0-dev \
# Install additional packages (for building mesa3d, libcamera and other meson-based components)
python3-pip pkg-config python3-dev ninja-build \
# Install additional packages (required by repo utility)
python-is-python3 \
# Add extra tools
sudo && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
# Install additional packages (for building mesa3d, libcamera and other meson-based components)
pip3 install mako jinja2 ply pyyaml
ENV RUN_USER user
ENV RUN_UID 1000
ENV USER_HOME /home/${RUN_USER}
RUN mkdir -pv ${USER_HOME}
# Create new user
RUN adduser \
--gecos 'Build User' \
--shell '/usr/bin/bash' \
--uid ${RUN_UID} \
--disabled-login \
--disabled-password ${RUN_USER} \
&& adduser ${RUN_USER} sudo
# Create project path
RUN mkdir -pv ${USER_HOME}/aosp
WORKDIR ${USER_HOME}/aosp
RUN chown -R ${RUN_USER}:${RUN_USER} ${USER_HOME} && chmod -R 775 ${USER_HOME}
# Ensure sudo group users are not
# asked for a password when using
# sudo command by ammending sudoers file
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> \
/etc/sudoers
# Pass control to a newly created user
USER ${RUN_USER}
# Install repo
RUN wget -P ${USER_HOME}/bin http://commondatastorage.googleapis.com/git-repo-downloads/repo && chmod a+x ${USER_HOME}/bin/repo
RUN git config --global user.name "FIRST_NAME LAST_NAME" && git config --global user.email "[email protected]"
CMD [ "/bin/bash" ]