Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile for the new Android enviroment #41

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions scripts/warnings-handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
supression_list = [
'WARNING:[CXX5106]', # warning is generated by gradle and AGP
'WARNING:[CXX5202]', # warning is generated by gradle and AGP, as each arch is built independently
'WARNING: [CXX5106]', # NDK 27 NDK was located by using ndk.dir property.
'WARNING: [CXX5202]', # This app only has 32-bit
'--illegal-access=permit; support was removed in 17.0', # OpenJDK warning not related to build
'warning: section flags ignored on section redeclaration', # x86 32-bit warning in jpeg-turbo
'warning: [removal] finalize() in Object has been deprecated and marked for removal', # https://github.com/opencv/opencv/issues/22260
Expand Down
1 change: 0 additions & 1 deletion ubuntu-github-actions--24.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ RUN \
liblapacke-dev \
libceres-dev \
libeigen3-dev \
libgtkglext1-dev \
libopenni2-dev \
libglfw3-dev \
lcov \
Expand Down
74 changes: 74 additions & 0 deletions ubuntu-github-actions-android/Dockerfile-35.0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Version: 20240917
# Image name: quay.io/opencv-ci/opencv-androidsdk-35
# For 4.x branch

FROM ubuntu:20.04

ARG GRADLE_VERSION=8.10
ARG ANDROID_BUILD_TOOLS_VERSION=35.0.0
ARG ANDROID_PLATFORM_VERSION=android-33
ARG ANDROID_TOOLS_ARCHIVE=commandlinetools-linux-6858069_latest.zip
ARG NDK_VERSION=27.0.12077973
ARG CMAKE_VERSION=3.22.1

USER root

ENV DEBIAN_FRONTEND noninteractive

RUN \
apt-get update && \
apt-get install -y --no-install-recommends \
software-properties-common \
build-essential ccache ninja-build \
python3 python3-pip curl zip unzip file \
openjdk-17-jdk libncurses5 \
&& \
add-apt-repository ppa:git-core/ppa && \
apt-get install -y --no-install-recommends git && \
rm -rf /var/lib/apt/lists/*

RUN mkdir -p /opt/gradle && \
curl -L -o /opt/gradle/gradle-$GRADLE_VERSION-bin.zip https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip && \
unzip -d /opt/gradle /opt/gradle/gradle-$GRADLE_VERSION-bin.zip

ENV ANDROID_HOME="/opt/android-sdk"

# find+chmod fixes permission issue for old tools package
RUN cd ~ && mkdir $ANDROID_HOME .android tmp \
&& cd tmp \
&& curl -o sdk.zip "https://dl.google.com/android/repository/$ANDROID_TOOLS_ARCHIVE" \
&& unzip sdk.zip \
&& rm sdk.zip \
&& find $ANDROID_HOME -executable -exec chmod a+rx {} \; \
&& mkdir -p $ANDROID_HOME/cmdline-tools/latest \
&& mv cmdline-tools/* $ANDROID_HOME/cmdline-tools/latest/ \
&& yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "platform-tools"

RUN yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses
RUN $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "build-tools;$ANDROID_BUILD_TOOLS_VERSION"
RUN $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "platforms;$ANDROID_PLATFORM_VERSION"
RUN $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "ndk;$NDK_VERSION"
RUN $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "cmake;$CMAKE_VERSION"

# Self-hosted runner UID is 1000
RUN useradd ci -m -s /bin/bash -G users --uid=1000
USER ci

RUN git config --global --add safe.directory "*" && \
git config --global user.email "opencv.ci" && \
git config --global user.name "opencv.ci" && \
git config --global pull.rebase false

ENV GRADLE_VERSION=$GRADLE_VERSION
ENV GRADLE_HOME=/opt/gradle/gradle-$GRADLE_VERSION
ENV GRADLE_OPTS="-Dorg.gradle.daemon=false -Dorg.gradle.workers.max=2"
ENV ANDROID_HOME="/opt/android-sdk"
ENV ANDROID_SDK="/opt/android-sdk"
ENV ANDROID_NDK="/opt/android-sdk/ndk/$NDK_VERSION"
ENV ANDROID_NDK_HOME="/opt/android-sdk/ndk/$NDK_VERSION"
ENV PATH=$GRADLE_HOME/bin:$ANDROID_HOME/cmake/$CMAKE_VERSION/bin:$PATH

# Run docker build from the root directory of the repository
COPY scripts/warnings-handling.py /home/ci/scripts/warnings-handling.py

ENTRYPOINT bash