服务器:ubuntu20

git克隆最新的ws-scrcpy代码

git clone https://github.com/NetrisTV/ws-scrcpy.git

进入ws-scrcpy目录新建Dockerfile文件,内容如下

FROM node:16-alpine
WORKDIR /app

RUN npm config set registry http://mirrors.cloud.tencent.com/npm/
RUN npm install -g node-gyp
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
RUN apk add android-tools make g++

COPY . .
RUN npm install
RUN npm run dist

EXPOSE 8000
CMD ["node","dist/index.js"]

构建ws-scrcpy镜像

docker build -t ws-scrcpy .

启动ws-scrcpy容器

docker run -d --name ws-scrcpy -p 8000:8000 ws-scrcpy

启动anroid 14模拟器

docker run -d --privileged -p 5555:5555 redroid/redroid:14.0.0-latest

ws-scrcpy连接android设备

docker exec ws-scrcpy adb connect ip:5555

浏览器访 http://主机IP:8000,显示如下

点击Broadway.jsH264 ConverterTiny H264 选一个速度快的访问即可

 

https://hub.docker.com/r/redroid/redroid

https://github.com/NetrisTV/ws-scrcpy

https://github.com/scavin/ws-scrcpy-docker

https://github.com/remote-android/redroid-doc

https://blog.imoeq.com/scrcpy-run-a-android-web-page/

https://meta.appinn.net/t/topic/33828

https://github.com/nodesource/distributions/blob/master/README.md

 

附:

node.js 18.x一键安装脚本,换版本就把18.x改成20.x。

curl -fsSL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh | sudo -E bash nodesource_setup.sh

安装node.js

sudo apt-get install -y nodejs

验证安装

node -v

参与评论