Skip to content

Commit ad9c35a

Browse files
committed
Make that docker images download android's ndk/sdk into a writable user location
Because we have some recipes that needs to interact with files in there, and we will get permission errors if those files are downloaded into a non user writable directory
1 parent 3695853 commit ad9c35a

File tree

2 files changed

+81
-84
lines changed

2 files changed

+81
-84
lines changed

Dockerfile.py2

Lines changed: 41 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,53 @@
1717

1818
FROM ubuntu:18.04
1919

20-
ENV ANDROID_HOME="/opt/android"
21-
2220
RUN apt -y update -qq \
2321
&& apt -y install -qq --no-install-recommends curl unzip \
2422
&& apt -y autoremove \
2523
&& apt -y clean
2624

25+
# install system dependencies
26+
RUN apt -y update -qq \
27+
&& apt -y install -qq --no-install-recommends \
28+
python virtualenv python-pip wget lbzip2 patch sudo \
29+
&& apt -y autoremove \
30+
&& apt -y clean
31+
32+
# build dependencies
33+
# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-16-04-64bit
34+
RUN dpkg --add-architecture i386 \
35+
&& apt -y update -qq \
36+
&& apt -y install -qq --no-install-recommends \
37+
build-essential ccache git python2.7 python2.7-dev \
38+
libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 \
39+
libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 \
40+
zip zlib1g-dev zlib1g:i386 \
41+
&& apt -y autoremove \
42+
&& apt -y clean
43+
44+
# specific recipes dependencies (e.g. libffi requires autoreconf binary)
45+
RUN apt -y update -qq \
46+
&& apt -y install -qq --no-install-recommends \
47+
libffi-dev autoconf automake cmake gettext libltdl-dev libtool pkg-config \
48+
&& apt -y autoremove \
49+
&& apt -y clean
50+
51+
52+
# set user env
53+
ENV USER="user"
54+
ENV HOME_DIR="/home/${USER}"
55+
ENV WORK_DIR="${HOME_DIR}" \
56+
PATH="${HOME_DIR}/.local/bin:${PATH}"
57+
58+
# prepare non root env
59+
RUN useradd --create-home --shell /bin/bash ${USER}
2760

61+
# with sudo access and no password
62+
RUN usermod -append --groups sudo ${USER}
63+
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
64+
65+
# set android env
66+
ENV ANDROID_HOME="${HOME_DIR}/android"
2867
ENV ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk"
2968
ENV ANDROID_NDK_VERSION="17c"
3069
ENV ANDROID_NDK_HOME_V="${ANDROID_NDK_HOME}-r${ANDROID_NDK_VERSION}"
@@ -78,46 +117,6 @@ RUN "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-19" && \
78117
chmod +x "${ANDROID_SDK_HOME}/tools/bin/avdmanager"
79118

80119

81-
ENV USER="user"
82-
ENV HOME_DIR="/home/${USER}"
83-
ENV WORK_DIR="${HOME_DIR}" \
84-
PATH="${HOME_DIR}/.local/bin:${PATH}"
85-
86-
# install system dependencies
87-
RUN apt -y update -qq \
88-
&& apt -y install -qq --no-install-recommends \
89-
python virtualenv python-pip wget lbzip2 patch sudo \
90-
&& apt -y autoremove \
91-
&& apt -y clean
92-
93-
# build dependencies
94-
# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-16-04-64bit
95-
RUN dpkg --add-architecture i386 \
96-
&& apt -y update -qq \
97-
&& apt -y install -qq --no-install-recommends \
98-
build-essential ccache git python2.7 python2.7-dev \
99-
libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 \
100-
libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 \
101-
zip zlib1g-dev zlib1g:i386 \
102-
&& apt -y autoremove \
103-
&& apt -y clean
104-
105-
# specific recipes dependencies (e.g. libffi requires autoreconf binary)
106-
RUN apt -y update -qq \
107-
&& apt -y install -qq --no-install-recommends \
108-
libffi-dev autoconf automake cmake gettext libltdl-dev libtool pkg-config \
109-
&& apt -y autoremove \
110-
&& apt -y clean
111-
112-
113-
# prepare non root env
114-
RUN useradd --create-home --shell /bin/bash ${USER}
115-
116-
# with sudo access and no password
117-
RUN usermod -append --groups sudo ${USER}
118-
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
119-
120-
121120
RUN pip install --upgrade cython==0.28.6
122121

123122
WORKDIR ${WORK_DIR}

Dockerfile.py3

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,52 @@
1717

1818
FROM ubuntu:18.04
1919

20-
ENV ANDROID_HOME="/opt/android"
21-
2220
RUN apt -y update -qq \
2321
&& apt -y install -qq --no-install-recommends curl unzip \
2422
&& apt -y autoremove \
2523
&& apt -y clean
2624

25+
# install system dependencies
26+
RUN apt -y update -qq \
27+
&& apt -y install -qq --no-install-recommends \
28+
python3 virtualenv python3-pip wget lbzip2 patch sudo \
29+
&& apt -y autoremove \
30+
&& apt -y clean
31+
32+
# build dependencies
33+
# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-16-04-64bit
34+
RUN dpkg --add-architecture i386 \
35+
&& apt -y update -qq \
36+
&& apt -y install -qq --no-install-recommends \
37+
build-essential ccache git python3 python3-dev \
38+
libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 \
39+
libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 \
40+
zip zlib1g-dev zlib1g:i386 \
41+
&& apt -y autoremove \
42+
&& apt -y clean
43+
44+
# specific recipes dependencies (e.g. libffi requires autoreconf binary)
45+
RUN apt -y update -qq \
46+
&& apt -y install -qq --no-install-recommends \
47+
libffi-dev autoconf automake cmake gettext libltdl-dev libtool pkg-config \
48+
&& apt -y autoremove \
49+
&& apt -y clean
2750

51+
# set user env
52+
ENV USER="user"
53+
ENV HOME_DIR="/home/${USER}"
54+
ENV WORK_DIR="${HOME_DIR}" \
55+
PATH="${HOME_DIR}/.local/bin:${PATH}"etc/sudoers
56+
57+
# prepare non root env
58+
RUN useradd --create-home --shell /bin/bash ${USER}
59+
60+
# with sudo access and no password
61+
RUN usermod -append --groups sudo ${USER}
62+
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
63+
64+
# set android env
65+
ENV ANDROID_HOME="${HOME_DIR}/android"
2866
ENV ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk"
2967
ENV ANDROID_NDK_VERSION="17c"
3068
ENV ANDROID_NDK_HOME_V="${ANDROID_NDK_HOME}-r${ANDROID_NDK_VERSION}"
@@ -78,46 +116,6 @@ RUN "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-19" && \
78116
chmod +x "${ANDROID_SDK_HOME}/tools/bin/avdmanager"
79117

80118

81-
ENV USER="user"
82-
ENV HOME_DIR="/home/${USER}"
83-
ENV WORK_DIR="${HOME_DIR}" \
84-
PATH="${HOME_DIR}/.local/bin:${PATH}"
85-
86-
# install system dependencies
87-
RUN apt -y update -qq \
88-
&& apt -y install -qq --no-install-recommends \
89-
python3 virtualenv python3-pip wget lbzip2 patch sudo \
90-
&& apt -y autoremove \
91-
&& apt -y clean
92-
93-
# build dependencies
94-
# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-16-04-64bit
95-
RUN dpkg --add-architecture i386 \
96-
&& apt -y update -qq \
97-
&& apt -y install -qq --no-install-recommends \
98-
build-essential ccache git python3 python3-dev \
99-
libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 \
100-
libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 \
101-
zip zlib1g-dev zlib1g:i386 \
102-
&& apt -y autoremove \
103-
&& apt -y clean
104-
105-
# specific recipes dependencies (e.g. libffi requires autoreconf binary)
106-
RUN apt -y update -qq \
107-
&& apt -y install -qq --no-install-recommends \
108-
libffi-dev autoconf automake cmake gettext libltdl-dev libtool pkg-config \
109-
&& apt -y autoremove \
110-
&& apt -y clean
111-
112-
113-
# prepare non root env
114-
RUN useradd --create-home --shell /bin/bash ${USER}
115-
116-
# with sudo access and no password
117-
RUN usermod -append --groups sudo ${USER}
118-
RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
119-
120-
121119
RUN pip3 install --upgrade cython==0.28.6
122120

123121
WORKDIR ${WORK_DIR}

0 commit comments

Comments
 (0)