From 68c9f254661a2f8d76fb9cc442bb514be7a04881 Mon Sep 17 00:00:00 2001 From: 7sunarni <710720732@qq.com> Date: Thu, 28 Nov 2024 18:57:12 +0800 Subject: [PATCH] chore(build): add dockerfile for building --- Dockerfile | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ce1126d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +FROM img/android:2024.11.1 + +WORKDIR sing-box-for-android + +USER root + +# Go environment +ENV GOBIN='/home/circleci/go/bin' +ENV GOPATH="/home/circleci/go" +ENV PATH="$PATH:/usr/local/go/bin:/home/circleci/go/bin" + +# prepare jdk +# prepare android ndk +RUN apt install openjdk-17-jdk && \ + update-alternatives --set java /usr/lib/jvm/java-17-openjdk-amd64/bin/java && \ + update-alternatives --set javac /usr/lib/jvm/java-17-openjdk-amd64/bin/javac && \ + update-alternatives --set javadoc /usr/lib/jvm/java-17-openjdk-amd64/bin/javadoc && \ + sdkmanager --install "ndk;26.2.11394342" + +# download sing-box source code +RUN cd .. && \ + wget https://codeload.github.com/SagerNet/sing-box/zip/refs/heads/main && \ + unzip main && \ + rm main && \ + mv sing-box-main sing-box && \ + wget https://go.dev/dl/go1.23.3.linux-amd64.tar.gz && \ + tar -C /usr/local -xzf go1.23.3.linux-amd64.tar.gz && \ + rm go1.23.3.linux-amd64.tar.gz + +COPY . . + +RUN cd ../sing-box && \ + make lib_install && \ + make lib_android && \ + make build_android \ No newline at end of file