-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.empty
More file actions
62 lines (50 loc) · 1.67 KB
/
Dockerfile.empty
File metadata and controls
62 lines (50 loc) · 1.67 KB
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
59
60
61
62
FROM archlinux:latest
# Install dependencies
RUN pacman -Sy --noconfirm base-devel git rustup
# Install aur dependencies
RUN mkdir /aur
RUN useradd --no-create-home --shell=/bin/false build && usermod -L build
RUN echo "build ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
RUN chown build:build /aur
USER build
ARG AUR_PKGS=
RUN for pkg in $AUR_PKGS; do \
git clone https://aur.archlinux.org/$pkg.git /aur/$pkg; \
cd /aur/$pkg; \
makepkg -si --noconfirm; \
cd /; \
rm -rf /aur/$pkg; \
done
USER root
ENV ANDROID_NDK_ROOT=/opt/android-ndk
ENV PATH=$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH
ARG OPENSSL_ARCH=
ARG OPENSSL_ANDROID_API=
ARG OPENSSL_VERSION=openssl-3.3.2
ARG CARGO_BUILD_TARGET=
ARG OPENSSL_CONFIGURE_EXTRA=
# Build OpenSSL for android
RUN git clone --depth 1 --branch ${OPENSSL_VERSION} https://github.com/openssl/openssl /openssl
WORKDIR /openssl
RUN if [ -z "$OPENSSL_ANDROID_API" ]; then \
./Configure $OPENSSL_ARCH $OPENSSL_CONFIGURE_EXTRA; \
else \
./Configure $OPENSSL_ANDROID_ARCH -D__ANDROID_API__=$OPENSSL_ANDROID_API; \
fi
RUN make -j$(nproc)
# Set env variables for cargo
# ARG CARGO_BUILD_TARGET=${CARGO_BUILD_TARGET:?}
# ENV CARGO_BUILD_TARGET=${CARGO_BUILD_TARGET}
WORKDIR /src
RUN userdel build
RUN useradd --home-dir /home/user --uid 1000 --user-group --create-home --shell /bin/sh user
RUN chown -R user:user /home/user /src
USER user
# Prepare rustup for android
RUN rustup toolchain install nightly
RUN rustup target add ${CARGO_BUILD_TARGET}
ENV OPENSSL_INCLUDE_DIR=/openssl/include
ENV OPENSSL_LIB_DIR=/openssl
ENV OPENSSL_STATIC=1
ENV CARGO_BUILD_TARGET=${CARGO_BUILD_TARGET}
RUN ["/bin/sh"]