# Use specific Ubuntu version for reproducibility FROM ubuntu:22.04 LABEL maintainer="Brax " \ description="Ubuntu Touch OS build environment" \ version="1.0" # Set build arguments for flexibility ARG CCACHE_SIZE=10G 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 dpkg --add-architecture i386 && \ apt-get update && \ apt-get install --no-install-recommends -y \ # Build essentials \ software-properties-common \ bc \ bison \ build-essential \ ccache \ curl \ git \ gnupg \ ca-certificates \ cpio \ curl \ fakeroot \ flex \ kmod \ libelf-dev \ libssl-dev \ libtinfo5 \ lz4 \ python3 \ sudo \ img2simg \ simg2img \ unzip \ zip \ wget \ zstd \ jq \ libncurses5 \ imagemagick \ liblz4-tool \ schedtool \ xsltproc \ rsync \ libxml2-utils \ python3-markdown \ tofrodos \ python2 \ gperf \ bzr \ libc6-dev \ libncurses5-dev:i386 \ x11proto-core-dev \ libx11-dev:i386 \ libreadline6-dev:i386 \ libgl1-mesa-glx:i386 \ libgl1-mesa-dev \ g++-multilib \ mingw-w64-i686-dev \ zlib1g-dev:i386 \ lzop \ xz-utils && \ # Clean up package cache apt-get autoclean && \ rm -rf /var/lib/apt/lists/* # python 2 is required for some android build tools RUN update-alternatives --install /usr/bin/python python /usr/bin/python2 1 # 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 # Add platform-tools to PATH ENV PATH="/opt/platform-tools:${PATH}" # 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 # Set entrypoint and default command ENTRYPOINT ["docker-entrypoint"] CMD ["/bin/bash"]