-
Notifications
You must be signed in to change notification settings - Fork 14
/
Dockerfile.template
138 lines (122 loc) · 5.46 KB
/
Dockerfile.template
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
FROM ubuntu:focal
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# hadolint ignore=DL3008
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
expect \
locales \
nano \
openjdk-%%JDK_VERSION%%-jdk \
unzip \
curl \
xz-utils \
git \
&& rm -rf /var/lib/apt/lists/*
# Seems somethings build better with utf8 locale specified
# http://jaredmarkell.com/docker-and-locales/
# https://github.com/square/moshi/issues/804#issuecomment-466926878
RUN locale-gen en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8
##<node>##
# hadolint ignore=DL3008
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apt-transport-https \
gnupg \
lsb-release \
# For nodejs we use nodesource, its nice and easy and gets us the correct version
# Find latest link https://github.com/nodesource/distributions/blob/master/README.md#installation-instructions
&& curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - \
&& echo "deb https://deb.nodesource.com/node_%%NODE_VARIANT%%.x $(lsb_release -s -c) main" | tee /etc/apt/sources.list.d/nodesource.list \
&& echo "deb-src https://deb.nodesource.com/node_%%NODE_VARIANT%%.x $(lsb_release -s -c) main" | tee -a /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
nodejs \
&& rm -rf /var/lib/apt/lists/*
# hadolint ignore=DL3016
RUN npm -g install xcode-build-tools yarn
##</node>##
# Install the SDK
# https://developer.android.com/studio#downloads
ENV ANDROID_CMDLINE_TOOLS=https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip
# hadolint ignore=DL3003
RUN ( \
cd /opt \
&& mkdir android-sdk-linux \
&& curl -sSL -o cmdline-tools.zip "$ANDROID_CMDLINE_TOOLS" \
&& unzip cmdline-tools.zip -d android-sdk-linux/cmdline-tools \
&& rm -f cmdline-tools.zip \
&& chown -R root:root android-sdk-linux \
)
ENV ANDROID_SDK_ROOT=/opt/android-sdk-linux
ENV ANDROID_HOME=$ANDROID_SDK_ROOT
ENV PATH=$ANDROID_HOME/cmdline-tools/cmdline-tools/bin:$ANDROID_HOME/cmdline-tools/tools/bin:$ANDROID_SDK_ROOT/tools/bin:$ANDROID_SDK_ROOT/tools:$ANDROID_SDK_ROOT/platform-tools:$PATH
# Install custom tools
COPY tools/license_accepter /opt/tools/
COPY tools/adb-all /opt/tools
ENV PATH=/opt/tools:$PATH
RUN license_accepter
# Install Android platform and things
ENV ANDROID_PLATFORM_VERSION=%%VARIANT%%
ENV ANDROID_BUILD_TOOLS_VERSION=%%BUILD_TOOLS%%
ENV PATH=$ANDROID_SDK_ROOT/build-tools/$ANDROID_BUILD_TOOLS_VERSION:$PATH
ENV ANDROID_EXTRA_PACKAGES=%%EXTRA_PACKAGES%%
ENV ANDROID_REPOSITORIES="extras;android;m2repository extras;google;m2repository"
ENV ANDROID_CONSTRAINT_PACKAGES="extras;m2repository;com;android;support;constraint;constraint-layout;1.0.2 extras;m2repository;com;android;support;constraint;constraint-layout;1.0.1 extras;m2repository;com;android;support;constraint;constraint-layout;1.0.0"
RUN sdkmanager --verbose "platform-tools" "platforms;android-$ANDROID_PLATFORM_VERSION" "build-tools;$ANDROID_BUILD_TOOLS_VERSION" $ANDROID_EXTRA_PACKAGES $ANDROID_REPOSITORIES $ANDROID_CONSTRAINT_PACKAGES
##<stf-client>##
# hadolint ignore=DL3008,DL3028,SC2086
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ruby \
&& savedAptMark="$(apt-mark showmanual)" \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
# stf-client
build-essential \
gem \
# Without rake fails to install stf-client
&& gem install rake stf-client --no-doc \
&& apt-mark auto '.*' > /dev/null \
&& apt-mark manual $savedAptMark > /dev/null \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -rf /var/lib/apt/lists/* \
RUN adb keygen ~/.android/adbkey
##</stf-client>##
##<emulator>##
# hadolint ignore=DL3008
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
file \
qt5-default \
libpulse0 \
&& rm -rf /var/lib/apt/lists/*
ENV ANDROID_EMULATOR_PACKAGE="system-images;android-$ANDROID_PLATFORM_VERSION;google_apis_playstore;x86_64"
RUN sdkmanager --verbose "emulator" $ANDROID_EMULATOR_PACKAGE
# Fix for emulator detect 64bit
ENV SHELL=/bin/bash
# https://www.bram.us/2017/05/12/launching-the-android-emulator-from-the-command-line/
ENV PATH=$ANDROID_SDK_ROOT/emulator:$PATH
COPY tools-emulator/android-start-emulator /opt/tools/
COPY tools-emulator/android-wait-for-emulator /opt/tools/
RUN adb keygen ~/.android/adbkey
##</emulator>##
##<ndk>##
ENV ANDROID_NDK_PACKAGES="ndk-bundle cmake;3.10.2.4988404 cmake;3.6.4111459 cmake;3.18.1"
ENV ANDROID_NDK_ROOT=$ANDROID_HOME/ndk-bundle
ENV ANDROID_NDK_HOME=$ANDROID_NDK_ROOT
RUN sdkmanager --verbose $ANDROID_NDK_PACKAGES
##</ndk>##
##<ruby-bundler>##
# hadolint ignore=DL3008,SC1091
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends gnupg2 \
&& rm -rf /var/lib/apt/lists/* \
&& gpg2 --keyserver keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB \
&& curl -sSL https://get.rvm.io | bash -s stable --ruby --without-gems="rvm rubygems-bundler" \
&& echo -e "source /usr/local/rvm/scripts/rvm\n$(cat /etc/bash.bashrc)" >/etc/bash.bashrc \
&& source /usr/local/rvm/scripts/rvm \
&& gem install bundler -v '~> 1.0' --force --no-document --default
ENV BASH_ENV="/usr/local/rvm/scripts/rvm"
##</ruby-bundler>##