-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile_prepare
66 lines (46 loc) · 1.65 KB
/
Dockerfile_prepare
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
63
64
65
66
#syntax=docker/dockerfile:1.2
FROM androidsdk/android-30 AS androidSDK
ENTRYPOINT "bash"
RUN chown -R android /opt/android-sdk-linux
# A to accept all file replace
RUN echo -e 'A\n' | runuser -u android android-sdk-update.sh built-in
RUN userdel android
FROM androidSDK AS scrcpyCompilePrepare
RUN apt-get update; \
apt-get install -y ffmpeg libsdl2-2.0-0 adb wget \
gcc git pkg-config ninja-build \
libavcodec-dev libavformat-dev libavutil-dev libsdl2-dev \
openjdk-11-jdk python3-pip \
apt-utils python3-pip \
android-tools-adb jq && \
pip3 install meson
SHELL ["/bin/bash", "-c"]
ARG USER_NAME
ARG USER_ID
ARG HIST_COMMAND="run.sh --compile"
VOLUME /scrcpy
RUN useradd --uid $USER_ID -oms /bin/bash $USER_NAME
RUN chown $USER_NAME /scrcpy ;
RUN mkdir /data && chown -R $USER_NAME /data
USER $USER_NAME
WORKDIR /scrcpy
RUN wget $( \
wget https://api.github.com/repos/Genymobile/scrcpy/releases/latest -O - | \
jq -r '[ .assets[] | select(.name | startswith("scrcpy-server-v")).browser_download_url ][0]' \
) -O /data/scrcpy-server
ENV COMPILED_AT=/scrcpymem/x
ENV USER_NAME=$USER_NAME
USER $USER_NAME
ENV PATH="${PATH}:/home/$USER_NAME"
COPY --chown="$USER_NAME" 'containerScripts' "/home/$USER_NAME"
RUN echo "$HIST_COMMAND" >> "/home/$USER_NAME/.bash_history"
RUN shopt -s dotglob && chmod +x "/home/$USER_NAME/"*.sh
USER 0
RUN shopt -s dotglob && cp -r "/home/$USER_NAME/"* "/root/"
USER $USER_NAME
RUN mkdir -p "/home/$USER_NAME/.gradle/caches";\
chmod -R 777 "/home/$USER_NAME/.gradle"; \
chown -R "$USER_NAME" "/home/$USER_NAME/.gradle"
SHELL ["/bin/bash", "-ic"]
ENTRYPOINT ["run.sh"]
CMD ["--prepare-only"]