Browse Source

Add scrcpy dockerfile

drymer 1 year ago
parent
commit
230a7919ad
Signed by: drymer <drymer@autistici.org> GPG Key ID: A307D64D5DDFDAAD
3 changed files with 37 additions and 1 deletions
  1. 2
    1
      buildAndPush.sh
  2. 26
    0
      scrcpy/Dockerfile
  3. 9
    0
      scrcpy/README.md

+ 2
- 1
buildAndPush.sh View File

@@ -6,6 +6,8 @@ set -o pipefail
6 6
 FILES="$(git diff HEAD~ --name-only -- '*Dockerfile*')"
7 7
 WRITE_REGISTRY="r.daemons.it"
8 8
 
9
+echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USER" --password-stdin r.daemons.it
10
+
9 11
 for file in $FILES
10 12
 do
11 13
     dockerfile="$(echo "$file" | sed 's/.*\///')"
@@ -21,7 +23,6 @@ do
21 23
     # production
22 24
     docker build $stage_target -t "$WRITE_REGISTRY/$docker_name:$tag" -t \
23 25
         "$WRITE_REGISTRY/$docker_name:latest" -f "$dockerfile" .
24
-    echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USER" --password-stdin r.daemons.it
25 26
     docker push "$WRITE_REGISTRY/$docker_name:$tag"
26 27
     docker push "$WRITE_REGISTRY/$docker_name:latest"
27 28
     cd ..

+ 26
- 0
scrcpy/Dockerfile View File

@@ -0,0 +1,26 @@
1
+FROM debian:stretch AS build
2
+
3
+ENV ANDROID_HOME=/android-sdk LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
4
+RUN apt update && apt install -y ffmpeg libsdl2-2.0.0 adb git wget make gcc \
5
+    openjdk-8-jdk pkg-config meson zip libavcodec-dev libavformat-dev \
6
+    libavutil-dev libsdl2-dev hicolor-icon-theme libgl1-mesa-dri \
7
+    libgl1-mesa-glx libpango1.0-0 libpulse0 libv4l-0 fonts-symbola locales \
8
+    && sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
9
+    locale-gen && mkdir $ANDROID_HOME && cd $ANDROID_HOME && wget \
10
+    https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip \
11
+    && unzip sdk* && rm sdk* && yes | $ANDROID_HOME/tools/bin/sdkmanager \
12
+    --licenses && cd / && git clone https://github.com/Genymobile/scrcpy
13
+
14
+RUN useradd -ms /bin/bash tmp && chown -R tmp /scrcpy /android-sdk
15
+USER tmp
16
+RUN cd scrcpy && meson x --buildtype release --strip -Db_lto=true && cd \
17
+    /scrcpy/x && ninja
18
+USER root
19
+RUN cd /scrcpy/x && ninja install
20
+
21
+FROM debian:stretch-slim
22
+COPY --from=build /usr/local/bin/scrcpy /usr/local/bin/scrcpy
23
+COPY --from=build /usr/local/share/scrcpy/ /usr/local/share/scrcpy/
24
+RUN apt update && mkdir /usr/share/man/man1 && apt install -y --no-install-recommends libgl1-mesa-dri ffmpeg libsdl2-2.0.0 adb
25
+
26
+ENTRYPOINT ["scrcpy"]

+ 9
- 0
scrcpy/README.md View File

@@ -0,0 +1,9 @@
1
+# scrcpy
2
+
3
+Visualize your android phone in your computer. More information
4
+[https://daemons.it/posts/visualizar-y-controlar-un-android-desde-el-ordenador/](here).
5
+You may use the next alias:
6
+
7
+```bash
8
+alias scrcpy="docker run -ti --privileged -v /dev/bus/usb:/dev/bus/usb -v ~/.android:/root/.android -v /tmp/.X12-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY -p 5037:5037 -v $HOME/.Xauthority:/root/.Xauthority --net=host scrcpy"
9
+```

Loading…
Cancel
Save