Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue: to bump version #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 28 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
### builder
FROM alpine:edge AS builder

ARG SCRCPY_VER=1.16
ARG SERVER_HASH="94a79e05b4498d0460ab7bd9d12cbf05156e3a47bf0c5d1420cee1d4493b3832"
FROM alpine:edge AS alpine-c-base-builder

RUN apk add --no-cache \
build-base \
curl \
ffmpeg-dev \
gcc \
git \
libusb \
libusb-dev \
make \
meson \
musl-dev \
openjdk8 \
pkgconf \
sdl2-dev

FROM alpine-c-base-builder AS builder

ARG SCRCPY_VER=v2.7
ARG SERVER_HASH="0019dfc4b32d63c1392aa264aed2253c1e0c2fb09216f8e2cc269bbfb8bb49b5"

RUN PATH=$PATH:/usr/lib/jvm/java-1.8-openjdk/bin
RUN curl -L -o scrcpy-server https://github.com/Genymobile/scrcpy/releases/download/v${SCRCPY_VER}/scrcpy-server-v${SCRCPY_VER}
RUN echo "$SERVER_HASH /scrcpy-server" | sha256sum -c -
Expand All @@ -26,30 +31,37 @@ RUN cd scrcpy/x && ninja
### runner
FROM alpine:edge AS runner

LABEL maintainer="Pierre Gordon <[email protected]>"

# needed for android-tools
RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories
RUN echo https://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories

LABEL maintainer="Pierre Gordon <[email protected]>"

RUN apk add --no-cache \
RUN apk add -U --no-cache \
android-tools \
ffmpeg \
libusb \
libusb-dev \
virtualgl

COPY --from=builder /scrcpy-server /usr/local/share/scrcpy/
COPY --from=builder /scrcpy/x/app/scrcpy /usr/local/bin/

### runner (amd)
FROM runner AS amd
FROM runner AS gallium

RUN apk add --no-cache mesa-dri-gallium

#### runner (amd)
#FROM runner AS amd

RUN apk add --no-cache mesa-dri-swrast
##RUN apk add --no-cache mesa-dri-swrast

### runner (intel)
FROM runner AS intel
#### runner (intel)
#FROM runner AS intel

RUN apk add --no-cache mesa-dri-intel
#RUN apk add --no-cache mesa-dri-intel

### runner (nvidia)
FROM runner AS nvidia
#### runner (nvidia)
#FROM runner AS nvidia

RUN apk add --no-cache mesa-dri-nouveau
#RUN apk add --no-cache mesa-dri-nouveau
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

Docker image to run [scrcpy](https://github.com/Genymobile/scrcpy).

## Build

`sudo docker build -t scrcpy:latest .`

## Usage

Before running the image, Docker must be allowed to connect to the X server:
Expand All @@ -30,7 +34,7 @@ For example: `pierlo1/scrcpy:amd`.
To run the image with Docker run:

```shell
docker run --rm -i -t --privileged \
sudo docker run --rm -i -t --privileged \
-v /dev/bus/usb:/dev/bus/usb \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=$DISPLAY \
Expand All @@ -45,7 +49,7 @@ For persistence, make a copy of `.env.example`, name it `.env`, and configure it
Once done, run the command:

```shell
docker-compose run --rm scrcpy
sudo docker-compose run --rm scrcpy
```

The `scrcpy_adb_keys` volume is used to preserve the `adb` authorization keys.
Expand Down
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.7'

services:
scrcpy:
image: pierlo1/scrcpy:${SCRCPY_GRAPHICS_TYPE:?Please set the SCRCPY_GRAPHICS_TYPE environment variable.}
image: scrcpy:${SCRCPY_GRAPHICS_TYPE:?Please set the SCRCPY_GRAPHICS_TYPE environment variable.}
volumes:
- /dev/bus/usb:/dev/bus/usb:ro
- /tmp/.X11-unix:/tmp/.X11-unix:ro
Expand All @@ -13,6 +13,7 @@ services:
ADB_VENDOR_KEYS: /root/.android
privileged: true
tty: true
command: scrcpy --video-codec=h265 --max-size=1920 --max-fps=60 --no-audio --keyboard=uhid

volumes:
scrcpy_adb_keys: