-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.android
74 lines (65 loc) · 2.14 KB
/
Dockerfile.android
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
65
66
67
68
69
70
71
72
73
74
#
# Dockerfile.android: Android build environment
#
# This enviroment expects TARGET and COMMAND envronment variables to be passed
# TARGET: Android lunch target.
# COMMAND: Command to run in Android directory. After running lunch. Most
# likely this should be something like "make -j24"
#
# Example usage:
# docker run -i -t -e TARGET="hikey-userdebug" -e COMMAND="make -j24" -v $PWD:/home/docker/android <docker img name>
#
FROM ubuntu:20.04
MAINTAINER John Stultz <[email protected]>
ENV TERM xterm
ARG DEBIAN_FRONTEND=noninteractive
# Update the image to the lastest updates
RUN apt-get update && apt-get -y dist-upgrade && apt-get clean && apt-get -y autoremove
# Get dependencies suggested by Google
# https://source.android.com/setup/build/initializing
RUN apt-get update && apt-get install -y \
git-core \
gnupg \
flex \
bison \
build-essential \
zip \
curl \
zlib1g-dev gcc-multilib \
g++-multilib \
libc6-dev-i386 \
libncurses5 \
lib32ncurses5-dev \
x11proto-core-dev \
libx11-dev \
lib32z1-dev \
libgl1-mesa-dev \
libxml2-utils \
xsltproc \
unzip \
fontconfig
# Get extra bits (mostly for mesa3d main branch testing)
RUN apt-get install -y \
gettext \
meson \
pkg-config \
python3-dev \
python3-mako \
python-is-python3
# make username a variable, so the script is portable
# add '--build-arg user_name=$USER' to the docker build command
ARG --description="user name for container" user_name=docker
RUN useradd -m $user_name
RUN echo 'export PATH="/usr/sbin/:/sbin/:$PATH"' >> /home/$user_name/.bashrc
# create run-script
run echo '#!/bin/bash' > /home/$user_name/run-script.sh
run echo 'if [ -z $TARGET ]; then echo "No TARGET value"; exit; fi' >> /home/$user_name/run-script.sh
run echo 'if [[ -z "${COMMAND}" ]]; then echo "No COMMAND value"; exit; fi' >> /home/$user_name/run-script.sh
run echo 'cd android' >> /home/$user_name/run-script.sh
run echo '. build/envsetup.sh' >> /home/$user_name/run-script.sh
run echo 'lunch $TARGET' >> /home/$user_name/run-script.sh
run echo '$COMMAND' >> /home/$user_name/run-script.sh
run chmod +x /home/$user_name/run-script.sh
WORKDIR /home/$user_name
USER $user_name
CMD ./run-script.sh