refactored the wsscrcpy dockerfile
This commit is contained in:
6
apps/ws-scrcpy/config.yaml
Normal file
6
apps/ws-scrcpy/config.yaml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
runGoogTracker: true
|
||||||
|
runApplTracker: false
|
||||||
|
|
||||||
|
server:
|
||||||
|
- secure: false
|
||||||
|
port: 8000
|
||||||
13
apps/ws-scrcpy/entrypoint.sh
Normal file
13
apps/ws-scrcpy/entrypoint.sh
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
adb start-server
|
||||||
|
|
||||||
|
if [ -n "$ADB_DEVICE_HOST" ]; then
|
||||||
|
echo "Connecting to ADB device at $ADB_DEVICE_HOST:${ADB_DEVICE_PORT:-5555}"
|
||||||
|
adb connect "$ADB_DEVICE_HOST:${ADB_DEVICE_PORT:-5555}"
|
||||||
|
sleep 2
|
||||||
|
adb devices
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec node index.js
|
||||||
27
dockerfiles/ws-scrcpy.Dockerfile
Normal file
27
dockerfiles/ws-scrcpy.Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
FROM node:25-bookworm
|
||||||
|
|
||||||
|
# System deps: ADB for device communication, build tools for native modules (node-pty)
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y android-tools-adb python3 make g++ git && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Clone and build ws-scrcpy
|
||||||
|
WORKDIR /build
|
||||||
|
RUN git clone --depth 1 https://github.com/NetrisTV/ws-scrcpy.git . && \
|
||||||
|
npm install && \
|
||||||
|
npm run dist:prod
|
||||||
|
|
||||||
|
# Set up runtime
|
||||||
|
WORKDIR /app
|
||||||
|
RUN cp -r /build/dist/* . && \
|
||||||
|
npm install && \
|
||||||
|
rm -rf /build
|
||||||
|
|
||||||
|
# Copy config and entrypoint from repo
|
||||||
|
COPY apps/ws-scrcpy/config.yaml /app/config.yaml
|
||||||
|
COPY apps/ws-scrcpy/entrypoint.sh /entrypoint.sh
|
||||||
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
|
EXPOSE 8000
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
FROM node:25.7.0-bookworm
|
|
||||||
|
|
||||||
# System deps: ADB for device communication, build tools for native modules (node-pty)
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y android-tools-adb python3 make g++ git && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Clone and build ws-scrcpy
|
|
||||||
WORKDIR /build
|
|
||||||
RUN git clone --depth 1 https://github.com/NetrisTV/ws-scrcpy.git . && \
|
|
||||||
npm install && \
|
|
||||||
npm run dist:prod
|
|
||||||
|
|
||||||
# Set up runtime
|
|
||||||
WORKDIR /app
|
|
||||||
RUN cp -r /build/dist/* . && \
|
|
||||||
npm install && \
|
|
||||||
rm -rf /build
|
|
||||||
|
|
||||||
# Config: Android tracker on, no iOS, HTTP on port 8000 (Traefik handles TLS)
|
|
||||||
RUN printf 'runGoogTracker: true\nrunApplTracker: false\n\nserver:\n - secure: false\n port: 8000\n' > /app/config.yaml
|
|
||||||
|
|
||||||
# Entrypoint: start ADB, connect to device if configured, then launch
|
|
||||||
RUN printf '#!/bin/bash\nset -e\nadb start-server\nif [ -n "$ADB_DEVICE_HOST" ]; then\n echo "Connecting to ADB device at $ADB_DEVICE_HOST:${ADB_DEVICE_PORT:-5555}"\n adb connect "$ADB_DEVICE_HOST:${ADB_DEVICE_PORT:-5555}"\n sleep 2\n adb devices\nfi\nexec node index.js\n' > /entrypoint.sh && \
|
|
||||||
chmod +x /entrypoint.sh
|
|
||||||
|
|
||||||
EXPOSE 8000
|
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
|
||||||
Reference in New Issue
Block a user