1
0
android-container/Dockerfile
James Ketrenos 35a7ede217 Added less install
Signed-off-by: James Ketrenos <james.p.ketrenos@intel.com>
2025-01-04 15:03:41 -08:00

152 lines
4.8 KiB
Docker

# pull base image
FROM ubuntu:jammy AS android-sdk
#
# From https://github.com/thyrlian/AndroidSDK/blob/master/android-sdk/Dockerfile
#
# support multiarch: i386 architecture
# install Java
# install essential tools
ARG JDK_VERSION=17
RUN dpkg --add-architecture i386 && \
apt-get update && \
apt-get dist-upgrade -y && \
apt-get install -y --no-install-recommends libncurses5:i386 libc6:i386 libstdc++6:i386 lib32gcc-s1 lib32ncurses6 lib32z1 zlib1g:i386 && \
apt-get install -y --no-install-recommends openjdk-${JDK_VERSION}-jdk && \
apt-get install -y --no-install-recommends git wget unzip && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# download and install Gradle
# https://services.gradle.org/distributions/
ARG GRADLE_VERSION=8.7
ARG GRADLE_DIST=bin
RUN cd /opt && \
wget -q https://services.gradle.org/distributions/gradle-${GRADLE_VERSION}-${GRADLE_DIST}.zip && \
unzip gradle*.zip && \
ls -d */ | sed 's/\/*$//g' | xargs -I{} mv {} gradle && \
rm gradle*.zip
# download and install Kotlin compiler
# https://github.com/JetBrains/kotlin/releases/latest
ARG KOTLIN_VERSION=1.9.23
RUN cd /opt && \
wget -q https://github.com/JetBrains/kotlin/releases/download/v${KOTLIN_VERSION}/kotlin-compiler-${KOTLIN_VERSION}.zip && \
unzip *kotlin*.zip && \
rm *kotlin*.zip
# download and install Android SDK
# https://developer.android.com/studio#command-line-tools-only
ARG ANDROID_SDK_VERSION=11076708
ENV ANDROID_HOME /opt/android-sdk
RUN mkdir -p ${ANDROID_HOME}/cmdline-tools && \
wget -q https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_VERSION}_latest.zip && \
unzip *tools*linux*.zip -d ${ANDROID_HOME}/cmdline-tools && \
mv ${ANDROID_HOME}/cmdline-tools/cmdline-tools ${ANDROID_HOME}/cmdline-tools/tools && \
rm *tools*linux*.zip
# set the environment variables
ENV JAVA_HOME /usr/lib/jvm/java-${JDK_VERSION}-openjdk-amd64
ENV GRADLE_HOME /opt/gradle
ENV KOTLIN_HOME /opt/kotlinc
ENV PATH ${PATH}:${GRADLE_HOME}/bin:${KOTLIN_HOME}/bin:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/cmdline-tools/tools/bin:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/emulator
# WORKAROUND: for issue https://issuetracker.google.com/issues/37137213
ENV LD_LIBRARY_PATH ${ANDROID_HOME}/emulator/lib64:${ANDROID_HOME}/emulator/lib64/qt/lib
# patch emulator issue: Running as root without --no-sandbox is not supported. See https://crbug.com/638180.
# https://doc.qt.io/qt-5/qtwebengine-platform-notes.html#sandboxing-support
ENV QTWEBENGINE_DISABLE_SANDBOX 1
# accept the license agreements of the SDK components
ADD license_accepter.sh /opt/
RUN chmod +x /opt/license_accepter.sh && /opt/license_accepter.sh $ANDROID_HOME
FROM android-sdk
# Seed image with necessary packages
RUN apt-get -q update \
&& DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
ca-certificates \
curl \
git \
libglu1-mesa \
unzip \
wget \
xz-utils \
zip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log}
# Install Node 18
RUN wget -qO- https://deb.nodesource.com/setup_18.x | bash -
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
nodejs \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} \
&& npm install -g npm@latest
# install global packages
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
ENV PATH /scripts:/home/node/.npm-global/bin:$PATH
RUN npm i --unsafe-perm --allow-root -g npm@latest
WORKDIR /projects
VOLUME "project"
ENTRYPOINT [ "entrypoint" ]
CMD [ "shell" ]
# set our node environment, either development or production
# defaults to production, compose overrides this to development on build and run
ARG NODE_ENV=production
ENV NODE_ENV $NODE_ENV
# default to port 19006 for node, and 19001 and 19002 (tests) for debug
ARG PORT=19006
ENV PORT $PORT
EXPOSE $PORT 19001 19002
# Setup flutter SDK path
ENV PATH "/usr/bin/flutter/bin:$PATH"
# Setup Anrdoid SDK path
RUN git config --global --add safe.directory /usr/bin/flutter
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
clang \
cmake \
ninja-build \
pkg-config \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log}
# Install build-essential, which includes g++ (required)
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log}
# Helper utilities...
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
nano \
openssh-client \
less \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log}
# Needed for running android emulator
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
xterm \
libpulse-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log}
COPY /scripts /scripts