Add scrcpy dockerfile

This commit is contained in:
drymer 2018-07-22 20:29:23 +02:00
parent 13bd9dc77e
commit 230a7919ad
Signed by: drymer
GPG Key ID: A307D64D5DDFDAAD
3 changed files with 37 additions and 1 deletions

View File

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

26
scrcpy/Dockerfile Normal file
View File

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

9
scrcpy/README.md Normal file
View File

@ -0,0 +1,9 @@
# scrcpy
Visualize your android phone in your computer. More information
[https://daemons.it/posts/visualizar-y-controlar-un-android-desde-el-ordenador/](here).
You may use the next alias:
```bash
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"
```