Add Dockerfile for building Android packages
This commit is contained in:
parent
076fc0f5b6
commit
f3d74e1128
92
build-scripts/docker/Dockerfile.android
Normal file
92
build-scripts/docker/Dockerfile.android
Normal file
|
@ -0,0 +1,92 @@
|
|||
# MIT License
|
||||
#
|
||||
# Simple DirectMedia Layer
|
||||
# Copyright (C) 2022-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
FROM ubuntu:22.04
|
||||
|
||||
WORKDIR /
|
||||
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN : \
|
||||
&& apt-get update -qq \
|
||||
&& apt-get install -qq -y openjdk-11-jdk vim git unzip libglu1 libpulse-dev libasound2 libc6 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxi6 libxtst6 libnss3 wget \
|
||||
&& apt-get install -qq -y cmake make ninja-build sudo zip \
|
||||
&& apt-get clean \
|
||||
&& :
|
||||
|
||||
ARG GRADLE_VERSION=7.5.1
|
||||
|
||||
# Download gradle, install gradle and gradlew
|
||||
RUN : \
|
||||
&& wget -q https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-bin.zip -P /tmp \
|
||||
&& unzip -q -d /opt/gradle /tmp/gradle-${GRADLE_VERSION}-bin.zip \
|
||||
&& rm /tmp/gradle-${GRADLE_VERSION}-bin.zip \
|
||||
&& mkdir /opt/gradlew \
|
||||
&& touch /opt/gradlew/settings.gradle \
|
||||
&& /opt/gradle/gradle-${GRADLE_VERSION}/bin/gradle wrapper --gradle-version ${GRADLE_VERSION} --distribution-type all -p /opt/gradlew \
|
||||
&& /opt/gradle/gradle-${GRADLE_VERSION}/bin/gradle wrapper -p /opt/gradlew \
|
||||
&& :
|
||||
|
||||
# https://developer.android.com/studio/
|
||||
ARG ANNDROID_CMD_LINE_TOOLS=linux-9123335_latest
|
||||
|
||||
RUN mkdir /opt/android
|
||||
RUN mkdir /opt/android/cmdline-tools
|
||||
RUN : \
|
||||
&& wget -q https://dl.google.com/android/repository/commandlinetools-${ANNDROID_CMD_LINE_TOOLS}.zip -P /tmp \
|
||||
&& unzip -q -d /opt/android/cmdline-tools /tmp/commandlinetools-${ANNDROID_CMD_LINE_TOOLS}.zip \
|
||||
&& rm \tmp/commandlinetools-${ANNDROID_CMD_LINE_TOOLS}.zip \
|
||||
&& :
|
||||
|
||||
ARG ANDROID_API_LEVEL=33
|
||||
# https://developer.android.com/studio/releases/build-tools
|
||||
ARG ANDROID_BUILD_TOOLS_LEVEL=33.0.1
|
||||
# https://developer.android.com/ndk/downloads
|
||||
ARG ANDROID_NDK_VERSION=21.4.7075529
|
||||
|
||||
# install packages and accept all licenses
|
||||
# cmdline-tools/cmdline-tools - the second "cmdline-tools" is the folder in the zip file
|
||||
RUN : \
|
||||
&& yes Y | /opt/android/cmdline-tools/cmdline-tools/bin/sdkmanager --install "build-tools;${ANDROID_BUILD_TOOLS_LEVEL}" "platforms;android-${ANDROID_API_LEVEL}" "platform-tools" "ndk;${ANDROID_NDK_VERSION}" \
|
||||
&& yes Y | /opt/android/cmdline-tools/cmdline-tools/bin/sdkmanager --licenses \
|
||||
&& :
|
||||
|
||||
# Environment variables to be used for build
|
||||
ENV GRADLE_HOME=/opt/gradle/gradle-${GRADLE_VERSION}
|
||||
ENV ANDROID_HOME=/opt/android
|
||||
ENV ANDROID_NDK_HOME=${ANDROID_HOME}/ndk/${ANDROID_NDK_VERSION}
|
||||
ENV PATH "$PATH:$GRADLE_HOME/bin:/opt/gradlew:${ANDROID_HOME}/emulator:${ANDROID_HOME}/cmdline-tools/tools/bin:${ANDROID_HOME}/platform-tools:${ANDROID_NDK_HOME}"
|
||||
ENV LD_LIBRARY_PATH "${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib"
|
||||
|
||||
ARG USERID=1000
|
||||
|
||||
RUN : \
|
||||
&& useradd -u ${USERID} -r -m user \
|
||||
&& yes password | passwd user \
|
||||
&& echo "user ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/user \
|
||||
&& usermod -s /bin/bash user \
|
||||
&& :
|
||||
|
||||
USER ${USERID}
|
Loading…
Reference in a new issue