Skip to content
Snippets Groups Projects
Dockerfile 1.47 KiB
Newer Older
Louis's avatar
Louis committed
# Use cimg/android:2025.04-ndk as the base image
FROM cimg/android:2025.04-ndk

Louis's avatar
Louis committed
USER root

Louis's avatar
Louis committed
# Set environment variables
ENV RUSTUP_HOME=/usr/local/rustup \
    CARGO_HOME=/usr/local/cargo \
    PATH=/usr/local/cargo/bin:$PATH

# Install dependencies
RUN sudo apt-get update && sudo apt-get install -y \
    build-essential \
    curl \
    wget \
    git \
    pkg-config \
    libssl-dev \
    clang \
    lld \
    cmake \
    && sudo rm -rf /var/lib/apt/lists/*

# Install Mold linker
RUN cd /tmp \
    && MOLD_VERSION=2.4.0 \
    && wget -q https://github.com/rui314/mold/releases/download/v${MOLD_VERSION}/mold-${MOLD_VERSION}-x86_64-linux.tar.gz \
    && sudo tar -C /usr/local --strip-components=1 -xzf mold-${MOLD_VERSION}-x86_64-linux.tar.gz \
    && rm mold-${MOLD_VERSION}-x86_64-linux.tar.gz

# Install Rust nightly
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly \
    && rustup --version \
    && cargo --version \
    && rustc --version

# Add Android targets for Rust
RUN rustup target add \
    aarch64-linux-android \
    armv7-linux-androideabi

# Install cargo-binstall for binary dependencies
RUN curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash

# Install cargo-ndk and other binary dependencies using binstall
RUN cargo binstall -y cargo-ndk

# Clean up
RUN sudo rm -rf /tmp/*

# Command to keep the container running
CMD ["bash"]