forked from jfloff/docker-lineageos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
112 lines (104 loc) · 3.62 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
FROM ubuntu:latest
LABEL maintainer="Ludovic LANGE <[email protected]>"
###################
# This Dockerfile was based on the following Dockerfiles
# - https://github.com/jfloff/docker-lineageos
# - https://github.com/nwereszczak/docker-lineageos
# - https://github.com/minz1/docker-lineageos
# - docker-lineageos: existing unoptimized image
# https://github.com/AnthoDingo/docker-lineageos/blob/autobuild/Dockerfile
#
# default user
ENV USER=lineageos
ENV \
# base dir
BASE_DIR=/home/$USER \
# device configuration dir
DEVICE_CONFIGS_DIR=/home/device-config
# install packages
RUN set -ex ;\
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
# install sdk
# https://wiki.lineageos.org/devices/klte/build#install-the-build-packages
android-sdk-platform-tools-common \
android-tools-adb \
android-tools-fastboot \
# install packages
# https://wiki.lineageos.org/devices/klte/build#install-the-build-packages
bc \
bison \
build-essential \
ccache \
curl \
ca-certificates \
flex \
g++-multilib \
gcc-multilib \
git \
gnupg \
gperf \
imagemagick \
lib32ncurses5-dev \
lib32readline-dev \
lib32z1-dev \
liblz4-tool \
libncurses5-dev \
libsdl1.2-dev \
libssl-dev \
libxml2 \
libxml2-utils \
lzop \
pngcrush \
rsync \
schedtool \
squashfs-tools \
xsltproc \
zip \
zlib1g-dev \
# extra packages
# for git-repo from google
python \
# for ps command
procps \
# no less on debian *gasp!*
less \
# so we have an editor inside the container
vim \
# has 'col' package needed for 'breakfast'
bsdmainutils \
# we can't build kernel on root (like docker runs)
# we add these so we have a non-root user
fakeroot \
sudo \
openjdk-11-jdk-headless \
;\
rm -rf /var/lib/apt/lists/*
# run config in a seperate layer so we cache it
RUN set -ex ;\
# User setup
# add our user and group first to make sure their IDs get assigned consistently, regardless of whatever dependencies get added
groupadd -r lineageos && useradd -r -g lineageos lineageos && usermod -u 1000 lineageos ;\
# allow non-root user to remount fs
# adding ALL permissions so they can do other stuff in the future, like sudo vim
echo "lineageos ALL=NOPASSWD: ALL" >> /etc/sudoers ;\
# Android Setup
# create paths: https://wiki.lineageos.org/devices/klte/build#create-the-directories
curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/bin/repo ;\
chmod a+x /usr/bin/repo ;\
# config git coloring
# check this link for things repo check:
# https://gerrit.googlesource.com/git-repo/+/master/subcmds/init.py#328
git config --global color.ui true ;\
# source init when any bash is called (which includes the lineageos script)
echo "source /etc/profile.d/init.sh" >> /etc/bash.bashrc
# copy default configuration into container
COPY default.env init.sh /etc/profile.d/
# copy script and config vars
COPY lineageos /bin
# copy dir with several PRed device configurations
COPY device-config $DEVICE_CONFIGS_DIR
RUN ln -s /lib/x86_64-linux-gnu/libtinfo.so.6 /lib/x86_64-linux-gnu/libtinfo.so.5
# set volume and user home folder
USER $USER
WORKDIR $BASE_DIR
CMD /bin/bash