# Use specific Ubuntu version for reproducibility FROM ubuntu:22.04 LABEL maintainer="Brax " \ description="IodeOS Android OS build environment" \ version="1.0" # Set build arguments for flexibility ARG CCACHE_SIZE=50G ARG DEBIAN_FRONTEND=noninteractive ARG TZ=UTC # Environment variables ENV DEBIAN_FRONTEND=${DEBIAN_FRONTEND} \ TZ=${TZ} \ USE_CCACHE=1 \ CCACHE_EXEC=/usr/bin/ccache \ JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 # Set timezone to prevent tzdata interactive prompt RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \ echo $TZ > /etc/timezone # Update package lists and install essential packages RUN apt-get update && \ apt-get install --no-install-recommends -y \ # Build essentials bc \ bison \ build-essential \ ccache \ curl \ flex \ g++-multilib \ gcc-multilib \ git \ git-lfs \ gnupg \ gperf \ imagemagick \ # Development libraries lib32ncurses5-dev \ lib32readline-dev \ lib32z1-dev \ libc6-dev-i386 \ libdw-dev \ libelf-dev \ libncurses5 \ libncurses5-dev \ libsdl1.2-dev \ libssl-dev \ libx11-dev \ libxml2 \ libxml2-utils \ # Compression and utilities lz4 \ lzop \ m4 \ pngcrush \ # Protocol buffers protobuf-compiler \ python3-protobuf \ # Python python-is-python3 \ python3-pip \ python3-virtualenv \ # Java openjdk-11-jdk \ # System utilities rsync \ schedtool \ software-properties-common \ squashfs-tools \ sudo \ unzip \ wget \ x11proto-core-dev \ xsltproc \ zip \ zlib1g-dev \ # Font support fontconfig && \ # Clean up package cache apt-get autoclean && \ rm -rf /var/lib/apt/lists/* # Download and install Android platform-tools RUN mkdir -p /opt/platform-tools && \ cd /opt/platform-tools && \ wget -q https://dl.google.com/android/repository/platform-tools-latest-linux.zip && \ unzip -q platform-tools-latest-linux.zip && \ rm platform-tools-latest-linux.zip && \ mv platform-tools/* . && \ rmdir platform-tools && \ chmod +x adb fastboot # Set up git LFS globally RUN git lfs install --system # Configure ccache RUN ccache -M ${CCACHE_SIZE} && \ ccache -s # Create workspace directory with proper ownership RUN mkdir -p /workspace && \ chown -R ${BUILD_USER}:${BUILD_USER} /workspace # Copy and set up entrypoint script COPY --chown=root:root docker-entrypoint.sh /usr/local/bin/docker-entrypoint COPY --chown=root:root docker-build.sh /usr/local/bin/docker-build RUN chmod +x /usr/local/bin/docker-entrypoint && \ chmod +x /usr/local/bin/docker-build # Switch to non-root user for security USER root WORKDIR /workspace # Set up user-specific configurations RUN echo 'export USE_CCACHE=1' >> ~/.bashrc && \ echo 'export CCACHE_EXEC=/usr/bin/ccache' >> ~/.bashrc && \ echo 'export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64' >> ~/.bashrc # Set entrypoint and default command ENTRYPOINT ["docker-entrypoint"] CMD ["/bin/bash"]