-
Notifications
You must be signed in to change notification settings - Fork 61
/
Dockerfile.gitlab
108 lines (90 loc) · 3.82 KB
/
Dockerfile.gitlab
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
FROM registry.ddbuild.io/images/docker:24.0.4-gbi-focal
ENV DEBIAN_FRONTEND=noninteractive
# Set timezone to UTC by default
RUN ln -sf /usr/share/zoneinfo/Etc/UTC /etc/localtime
# keep in sync with JAVA_HOME path below
RUN apt-get update \
&& apt-get -y install openjdk-17-jdk \
&& rm -rf /var/lib/apt/lists/*
RUN set -x \
&& apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install --no-install-recommends \
curl \
git \
unzip \
wget \
openssh-client \
expect \
python3-distutils \
python3-apt \
&& apt-get -y clean \
&& rm -rf /var/lib/apt/lists/*
ENV GRADLE_VERSION 8.10.2
ENV ANDROID_COMPILE_SDK 35
ENV ANDROID_BUILD_TOOLS 35.0.0
ENV ANDROID_SDK_TOOLS 11076708
ENV NDK_VERSION 25.1.8937393
ENV CMAKE_VERSION 3.22.1
ENV DD_TRACER_VERSION 1.41.0
# requires build with BuildKit to be available https://docs.docker.com/build/building/variables/#multi-platform-build-arguments
ARG TARGETARCH
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-${TARGETARCH}
RUN apt update && apt install -y python3
# Install pip for aws
RUN set -x \
&& curl -OL https://bootstrap.pypa.io/get-pip.py \
&& python3 get-pip.py \
&& rm get-pip.py
RUN python3 --version
RUN set -x \
&& pip install awscli
# Gradle
RUN \
cd /usr/local && \
curl -L https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip -o gradle-${GRADLE_VERSION}-bin.zip && \
unzip gradle-${GRADLE_VERSION}-bin.zip && \
rm gradle-${GRADLE_VERSION}-bin.zip
# Workaround for
# Warning: File /root/.android/repositories.cfg could not be loaded.
RUN mkdir /root/.android \
&& touch /root/.android/repositories.cfg
# Android SDK
RUN \
wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS}_latest.zip && \
mkdir -p android-sdk-linux/cmdline-tools && \
unzip -d android-sdk-linux/cmdline-tools android-sdk.zip && \
mv android-sdk-linux/cmdline-tools/cmdline-tools android-sdk-linux/cmdline-tools/latest && \
echo y | android-sdk-linux/cmdline-tools/latest/bin/sdkmanager "platforms;android-${ANDROID_COMPILE_SDK}" >/dev/null && \
echo y | android-sdk-linux/cmdline-tools/latest/bin/sdkmanager "platform-tools" >/dev/null && \
echo y | android-sdk-linux/cmdline-tools/latest/bin/sdkmanager "build-tools;${ANDROID_BUILD_TOOLS}" >/dev/null && \
echo y | android-sdk-linux/cmdline-tools/latest/bin/sdkmanager --install "ndk;${NDK_VERSION}" >/dev/null && \
echo y | android-sdk-linux/cmdline-tools/latest/bin/sdkmanager --install "cmake;${CMAKE_VERSION}" >/dev/null && \
(yes || true) | android-sdk-linux/cmdline-tools/latest/bin/sdkmanager --licenses
RUN set -x \
&& curl -OL https://s3.amazonaws.com/dd-package-public/dd-package.deb && dpkg -i dd-package.deb && rm dd-package.deb \
&& apt-get update \
&& apt-get -y clean \
&& rm -rf /var/lib/apt/lists/*
ENV ANDROID_SDK_ROOT $PWD/android-sdk-linux
ENV ANDROID_HOME $PWD/android-sdk-linux
ENV GRADLE_HOME /usr/local/gradle-${GRADLE_VERSION}
ENV ANDROID_NDK $ANDROID_SDK_ROOT/ndk/${NDK_VERSION}
ENV PATH $PATH:$GRADLE_HOME/bin
ENV PATH $PATH:$ANDROID_HOME/platform-tools
ENV PATH $PATH:$ANDROID_SDK_ROOT/build-tools/${ANDROID_BUILD_TOOLS}:$ANDROID_NDK
# Install Node
ENV NODENV_VERSION 16.13.0
ENV NODENV_ROOT /root/.nodenv
ENV PATH "$NODENV_ROOT/shims:$NODENV_ROOT/bin:$PATH"
RUN set -x \
&& curl -fsSL https://github.com/nodenv/nodenv-installer/raw/master/bin/nodenv-installer | bash \
&& nodenv install $NODENV_VERSION \
&& nodenv rehash
# Install Datadog CI
RUN npm install -g [email protected]
RUN npm install -g @datadog/datadog-ci
# Install Datadog Java tracer
ENV DD_TRACER_FOLDER $PWD/dd-java-agent
RUN mkdir -p $DD_TRACER_FOLDER
RUN wget -O $DD_TRACER_FOLDER/dd-java-agent.jar https://repo1.maven.org/maven2/com/datadoghq/dd-java-agent/$DD_TRACER_VERSION/dd-java-agent-$DD_TRACER_VERSION.jar