Skip to content
Snippets Groups Projects
Commit b9e8d74e authored by Louis's avatar Louis :fire:
Browse files

Set up deps in docker file

parents
No related branches found
No related tags found
No related merge requests found
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Environment-dependent path to Maven home directory
/mavenHomeManager.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/android-rust-builder.iml" filepath="$PROJECT_DIR$/android-rust-builder.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
# Use cimg/android:2025.04-ndk as the base image
FROM cimg/android:2025.04-ndk
# 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"]
# Android Rust Builder
This Docker image is designed for building Rust-based Android projects. It provides a pre-configured environment with all the necessary tools to compile Rust code for Android targets.
## Features
- Based on CircleCI's Android image (cimg/android:2025.04-ndk)
- Rust nightly toolchain
- Android targets for Rust:
- aarch64-linux-android
- armv7-linux-androideabi
- x86_64-linux-android
- i686-linux-android
- Clang compiler
- Mold linker (for faster linking)
- Cargo-binstall for fast installation of binary dependencies
- Cargo NDK for easy Android builds
## Usage
### Building the Docker Image
<?xml version="1.0" encoding="UTF-8"?>
<module type="GENERAL_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment