-
Notifications
You must be signed in to change notification settings - Fork 42
/
Dockerfile
113 lines (106 loc) · 3.56 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
113
FROM eclipse-temurin:8-jammy
LABEL maintainer="jfloff@inesc-id.pt"
###################
# This Dockerfile was based on the following Dockerfiles
# - 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 && 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 \
flex \
g++-multilib \
gcc-multilib \
git \
gnupg \
gperf \
imagemagick \
lib32ncurses5-dev \
lib32readline-dev \
lib32z1-dev \
libelf-dev \
liblz4-tool \
libncurses5 \
libncurses5-dev \
libsdl1.2-dev \
libssl-dev \
libxml2 \
libxml2-utils \
lzop \
pngcrush \
rsync \
schedtool \
squashfs-tools \
xsltproc \
zip \
zlib1g-dev \
# extra packages
# for repo
python3 \
# for repo
openssh-client \
# 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 \
# unzip is needed at least for Fairphone 4 build
unzip \
# we can't build kernel on root (like docker runs)
# we add these so we have a non-root user
fakeroot \
sudo \
;\
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 ;\
ln -s /usr/bin/python3 /usr/bin/python && \
# 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
# set volume and user home folder
RUN mkdir -p "$BASE_DIR" && chown "$USER:$USER" "$BASE_DIR"
USER $USER
WORKDIR $BASE_DIR
CMD /bin/bash