-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockerfile
58 lines (44 loc) · 2.89 KB
/
dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# FROM saschpe/android-ndk:jdk11_api31_30.0.3_ndk21.4.7075529_cmake3.18.1
FROM saschpe/android-ndk:32-jdk11.0.15_10-ndk25.0.8775105-cmake3.18.1
ARG NDK_VERSION=25.0.8775105
LABEL author "BFChain"
ENV DEBIAN_FRONTEND=noninteractive \
ANDROID_NDK_ROOT="/opt/android-sdk-linux/ndk/${NDK_VERSION}" \
PATH="$PATH:/opt/android-sdk-linux/ndk/${NDK_VERSION}/toolchains/llvm/prebuilt/linux-x86_64/bin:/root/.cargo/bin" \
RUSTY_V8_MIRROR="/plaoc/rust_lib/assets/rusty_v8_mirror/"
# RUSTY_V8_ARCHIVE="/plaoc/rust_lib/assets/rusty_v8_mirror/v0.48.1/librusty_v8_release_aarch64-linux-android.a"
# NDK相关环境配置
# RUN mkdir -p /opt/android/ndk && cd /opt/android/ndk
# RUN wget https://dl.google.com/android/repository/android-ndk-r22b-linux-x86_64.zip && unzip /android-ndk-r22b-linux-x86_64.zip
# rust
RUN apt-get update && \
apt-get install curl autoconf libtool automake build-essential -y && \
cd $ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/ && \
cp aarch64-linux-android30-clang aarch64-linux-android-clang && \
curl https://sh.rustup.rs -sSf | \
sh -s -- --default-toolchain stable -y \
source "$HOME/.cargo/env"
RUN rustup target add aarch64-linux-android
RUN echo '[target.aarch64-linux-android]\n'\
'ar = "/opt/android-sdk-linux/ndk/25.0.8775105/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-ar"\n'\
'linker = "/opt/android-sdk-linux/ndk/25.0.8775105/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android28-clang++"\n'\
'[target.armv7-linux-androideabi]\n'\
'linker = "/opt/android-sdk-linux/ndk/25.0.8775105/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi28-clang++"\n'\
'[target.x86_64-linux-android]\n'\
'linker = "/opt/android-sdk-linux/ndk/25.0.8775105/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android28-clang++"\n'\
> ~/.cargo/config.toml
# docker 多cpu架构支持
# docker buildx ls
# docker buildx create --name mybuilder
# docker buildx use mybuilder 或者直接写 docker buildx use default
# docker buildx inspect --bootstrap
# 如何在linux/amd64构建arm64
#docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
#docker buildx create --name multiarch --driver docker-container --use
#docker buildx inspect --bootstrap
# 如果要构建新镜像 docker build -t waterbang/aarch64-linux-android:arm-ndk21-rust1.63.0 .
#ndk21 docker buildx build --platform linux/arm64 -t waterbang/aarch64-linux-android:arm-ndk21-rust1.63.0 --push .
#ndk25 docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t waterbang/aarch64-linux-android:arm-ndk25-rust1.63.0 --push --output=type=docker .
#docker run --rm -it -v /Users/mac/Desktop/waterbang/project/plaoc/qemu-aarch64-static:/usr/bin/qemu-aarch64-static waterbang/aarch64-linux-android:arm-ndk25-rust1.63.0 /bin/bash
# 接下来 cd /plaoc/rust_lib
# 执行 RUST_BACKTRACE=1 cargo build -vv --target=aarch64-linux-android --release