This repository has been archived by the owner on Jul 23, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
94 lines (80 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
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
FROM ubuntu:20.04
# Build arguments
ARG android_sdk_version
ARG android_build_tools_version
ARG nodejs_version
ARG user_name='user'
ARG user_id='1000'
ARG group_name='mount'
ARG group_id='1000'
# Update package repositories and install packages
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get install -y \
adb \
curl \
git \
libglu1-mesa \
openjdk-8-jdk \
unzip \
usbutils \
xz-utils \
wget \
zip \
gnupg \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Node.js and Yarn
RUN curl "https://deb.nodesource.com/setup_${nodejs_version}.x" | bash
RUN curl -sS 'https://dl.yarnpkg.com/debian/pubkey.gpg' | apt-key add -
RUN echo 'deb https://dl.yarnpkg.com/debian/ stable main' | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive \
apt-get install -y \
nodejs \
yarn
# Create non-system user
RUN addgroup --gid "${group_id}" "${group_name}" \
&& useradd \
--create-home \
--shell /bin/bash \
--uid "${user_id}" \
--gid "${group_id}" \
"${user_name}" \
&& usermod -aG plugdev "${user_name}"
# Set non-system user
USER "${user_name}"
ENV HOME="/home/${user_name}"
# Change workdir
WORKDIR "${HOME}"
# Prepare Android SDK directory structure
RUN mkdir -p Android/sdk \
&& mkdir -p .android \
&& touch .android/repositories.cfg
# Android SDK env variables
ENV ANDROID_SDK_ROOT "${HOME}/Android/sdk"
# Download Android SDK tools
RUN wget -O sdk-tools.zip https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip \
--no-verbose \
--show-progress \
--progress=bar:force \
&& unzip sdk-tools.zip \
&& rm sdk-tools.zip \
&& mv tools "${ANDROID_SDK_ROOT}/tools"
# Install Android SDK tools
RUN cd "${ANDROID_SDK_ROOT}/tools/bin" \
&& yes | ./sdkmanager --licenses \
&& ./sdkmanager \
"build-tools;${android_build_tools_version}" \
'patcher;v4' \
'platform-tools' \
"platforms;android-${android_sdk_version}" \
"sources;android-${android_sdk_version}"
# Add Android SDK tools to PATH
ENV PATH "${PATH}:${ANDROID_SDK_ROOT}/platform-tools"
# Add yarn bin to PATH
ENV PATH "${PATH}:${HOME}/.yarn/bin"
# Install npm libraries with Yarn
RUN yarn global add \
react-native-cli \
npx