mirror of
https://github.com/kasmtech/workspaces-images.git
synced 2024-11-21 23:53:10 +01:00
Merge branch 'feature/KASM-1209_redroid' into 'develop'
Resolve KASM-1209 "Feature/ redroid" Closes KASM-1209 See merge request kasm-technologies/internal/workspaces-images!160
This commit is contained in:
commit
d189f987b5
@ -115,6 +115,20 @@ multiImages:
|
||||
changeFiles:
|
||||
- dockerfile-kasm-qbittorrent
|
||||
- src/ubuntu/install/qbittorrent/**
|
||||
- name: redroid
|
||||
base: core-ubuntu-jammy
|
||||
dockerfile: dockerfile-kasm-redroid
|
||||
changeFiles:
|
||||
- dockerfile-kasm-redroid
|
||||
- src/ubuntu/install/redroid/**
|
||||
- src/ubuntu/install/android_studio/**
|
||||
- src/ubuntu/install/misc/**
|
||||
- src/ubuntu/install/sublime_text/**
|
||||
- src/ubuntu/install/vs_code/**
|
||||
- src/ubuntu/install/chrome/**
|
||||
- src/ubuntu/install/chromium/**
|
||||
- src/ubuntu/install/tools/**
|
||||
- src/ubuntu/install/cleanup/**
|
||||
- name: remmina
|
||||
base: core-ubuntu-focal
|
||||
dockerfile: dockerfile-kasm-remmina
|
||||
|
55
dockerfile-kasm-redroid
Normal file
55
dockerfile-kasm-redroid
Normal file
@ -0,0 +1,55 @@
|
||||
ARG BASE_TAG="develop"
|
||||
ARG BASE_IMAGE="core-ubuntu-jammy"
|
||||
FROM kasmweb/$BASE_IMAGE:$BASE_TAG
|
||||
USER root
|
||||
|
||||
ENV HOME /home/kasm-default-profile
|
||||
ENV STARTUPDIR /dockerstartup
|
||||
WORKDIR $HOME
|
||||
|
||||
### Envrionment config
|
||||
ENV DEBUG=false \
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
SKIP_CLEAN=true \
|
||||
KASM_RX_HOME=$STARTUPDIR/kasmrx \
|
||||
DONT_PROMPT_WSL_INSTALL="No_Prompt_please" \
|
||||
INST_DIR=$STARTUPDIR/install \
|
||||
INST_SCRIPTS="/ubuntu/install/dind/install_dind.sh \
|
||||
/ubuntu/install/tools/install_tools_deluxe.sh \
|
||||
/ubuntu/install/misc/install_tools.sh \
|
||||
/ubuntu/install/chrome/install_chrome.sh \
|
||||
/ubuntu/install/chromium/install_chromium.sh \
|
||||
/ubuntu/install/sublime_text/install_sublime_text.sh \
|
||||
/ubuntu/install/vs_code/install_vs_code.sh \
|
||||
/ubuntu/install/redroid/install_redroid.sh \
|
||||
/ubuntu/install/android_studio/install_android_studio.sh \
|
||||
/ubuntu/install/cleanup/cleanup.sh"
|
||||
|
||||
# Startup Scripts
|
||||
COPY ./src/ubuntu/install/redroid/custom_startup.sh $STARTUPDIR/custom_startup.sh
|
||||
RUN chmod 755 $STARTUPDIR/custom_startup.sh
|
||||
COPY ./src/ubuntu/install/dind/dockerd.conf /etc/supervisor/conf.d/
|
||||
RUN cp /usr/share/extra/backgrounds/bg_kasm.png /usr/share/extra/backgrounds/bg_default.png
|
||||
|
||||
# Copy install scripts
|
||||
COPY ./src/ $INST_DIR
|
||||
|
||||
# Run installations
|
||||
RUN \
|
||||
for SCRIPT in $INST_SCRIPTS; do \
|
||||
bash ${INST_DIR}${SCRIPT}; \
|
||||
done && \
|
||||
$STARTUPDIR/set_user_permission.sh $HOME && \
|
||||
rm -f /etc/X11/xinit/Xclients && \
|
||||
chown 1000:0 $HOME && \
|
||||
mkdir -p /home/kasm-user && \
|
||||
chown -R 1000:0 /home/kasm-user && \
|
||||
rm -Rf ${INST_DIR}
|
||||
|
||||
|
||||
# Userspace Runtime
|
||||
ENV HOME /home/kasm-user
|
||||
WORKDIR $HOME
|
||||
USER 1000
|
||||
|
||||
CMD ["--tail-log"]
|
24
docs/redroid/README.md
Normal file
24
docs/redroid/README.md
Normal file
@ -0,0 +1,24 @@
|
||||
# About This Image
|
||||
|
||||
This Image contains a browser-accessible version of [Redroid](https://github.com/remote-android/redroid-doc).
|
||||
redroid (Remote-Android) is a multi-arch, GPU enabled, Android in Cloud solution.
|
||||
|
||||
![Screenshot][Image_Screenshot]
|
||||
|
||||
[Image_Screenshot]: https://f.hubspotusercontent30.net/hubfs/5856039/dockerhub/image-screenshots/redroid.png "Image Screenshot"
|
||||
## Important !!
|
||||
|
||||
This image requires host level kernel modules to be installed and loaded.
|
||||
See [Redroid Docs](https://github.com/remote-android/redroid-doc?tab=readme-ov-file#getting-started) for more details
|
||||
|
||||
|
||||
# Environment Variables
|
||||
|
||||
* `REDROID_GPU_GUEST_MODE` - Used to instruct redroid to utilize GPU rendering. Options are `auto`, `guest`, and `host`
|
||||
* `REDROID_FPS` - Set the maximum FPS for redroid and scrcpy.
|
||||
* `REDROID_WIDTH` - Set the desired width of the redroid device.
|
||||
* `REDROID_HEIGHT` - Set the desired height of the redroid device.
|
||||
* `REDROID_DPI` - Set the desired DPI of the redroid device.
|
||||
* `REDROID_SHOW_CONSOLE` - Display the scrcpy console after launching the redroid device.
|
||||
* `REDROID_DISABLE_AUTOSTART` - If set to "1", the container will not automatically pull and start the redroid container and scrcpy.
|
||||
* `REDROID_DISABLE_HOST_CHECKS` - If set to "1", the container will not check for the presence of required host level kernel modules.
|
9
docs/redroid/demo.txt
Normal file
9
docs/redroid/demo.txt
Normal file
@ -0,0 +1,9 @@
|
||||
# Live Demo
|
||||
|
||||
<a href="https://app.kasmweb.com/#/cast/87592435803135" target="_blank"><img src="https://info.kasmweb.com/hubfs/dockerhub/GIFs/redroid.gif" width="640" height="360"></a>
|
||||
|
||||
**Launch a real-time demo in a new browser window:** <a href="https://app.kasmweb.com/#/cast/87592435803135" target="_blank">Live Demo</a>.
|
||||
|
||||
<a href="https://app.kasmweb.com/#/cast/87592435803135" target="_blank"><img src="https://5856039.fs1.hubspotusercontent-na1.net/hub/5856039/hubfs/dockerhub/casting-buttons/redroid.png" width="300" height="104"></a>
|
||||
|
||||
∗*Note: Demo is limited to 3 minutes and has upload/downloads restricted for security purposes.*
|
1
docs/redroid/description.txt
Normal file
1
docs/redroid/description.txt
Normal file
@ -0,0 +1 @@
|
||||
Redroid (Remote-Android) for Kasm Workspaces
|
45
src/ubuntu/install/android_studio/install_android_studio.sh
Normal file
45
src/ubuntu/install/android_studio/install_android_studio.sh
Normal file
@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
|
||||
ARCH=$(arch | sed 's/aarch64/arm64/g' | sed 's/x86_64/amd64/g')
|
||||
if [ "$ARCH" == "arm64" ] ; then
|
||||
echo "Android studio not supported on arm64, skipping installation"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
apt-get update
|
||||
apt-get install -y libc6:i386 libncurses5:i386 libstdc++6:i386 lib32z1 libbz2-1.0:i386 openjdk-18-jdk
|
||||
|
||||
# https://developer.android.com/studio/archive
|
||||
# curl https://developer.android.com/studio | grep android-studio | grep -i "linux.tar.gz" | grep ide-zips | cut -d '"' -f2
|
||||
ANDROID_STUDIO_DOWNLOAD_URL="https://redirector.gvt1.com/edgedl/android/studio/ide-zips/2023.1.1.26/android-studio-2023.1.1.26-linux.tar.gz"
|
||||
|
||||
curl -o /tmp/android_studio.tar.gz -L "${ANDROID_STUDIO_DOWNLOAD_URL}"
|
||||
|
||||
mkdir -p /opt
|
||||
cd /tmp
|
||||
tar -zxvf /tmp/android_studio.tar.gz -C /opt/
|
||||
rm /tmp/android_studio.tar.gz
|
||||
ln -sf /opt/android-studio/bin/studio.sh /bin/android-studio
|
||||
chown 1000:1000 /opt/android-studio
|
||||
|
||||
|
||||
cat >/usr/share/applications/android-studio.desktop <<EOL
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Type=Application
|
||||
Name=Android Studio
|
||||
Comment=Android Studio
|
||||
Exec=bash -i "/opt/android-studio/bin/studio.sh" %f
|
||||
Icon=/opt/android-studio/bin/studio.png
|
||||
Categories=Development;IDE;
|
||||
Terminal=false
|
||||
StartupNotify=true
|
||||
StartupWMClass=jetbrains-android-studio
|
||||
Name[en_GB]=android-studio.desktop
|
||||
EOL
|
||||
|
||||
cp /usr/share/applications/android-studio.desktop $HOME/Desktop/android-studio.desktop
|
||||
chown 1000:1000 $HOME/Desktop/android-studio.desktop
|
||||
chmod +x $HOME/Desktop/android-studio.desktop
|
118
src/ubuntu/install/redroid/custom_startup.sh
Normal file
118
src/ubuntu/install/redroid/custom_startup.sh
Normal file
@ -0,0 +1,118 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
START_COMMAND="/usr/bin/supervisord"
|
||||
DOCKER_PGREP="supervisord"
|
||||
SCRCPY_PGREP="scrcpy"
|
||||
DEFAULT_ARGS="-n"
|
||||
ARGS=${APP_ARGS:-$DEFAULT_ARGS}
|
||||
ANDROID_VERSION=${ANDROID_VERSION:-"13.0.0"}
|
||||
REDROID_GPU_GUEST_MODE=${REDROID_GPU_GUEST_MODE:-"guest"}
|
||||
REDROID_FPS=${REDROID_FPS:-"30"}
|
||||
REDROID_WIDTH=${REDROID_WIDTH:-"720"}
|
||||
REDROID_HEIGHT=${REDROID_HEIGHT:-"1280"}
|
||||
REDROID_DPI=${REDROID_DPI:-"320"}
|
||||
REDROID_SHOW_CONSOLE=${REDROID_SHOW_CONSOLE:-"1"}
|
||||
REDROID_DISABLE_AUTOSTART=${REDROID_DISABLE_AUTOSTART:-"0"}
|
||||
REDROID_DISABLE_HOST_CHECKS=${REDROID_DISABLE_HOST_CHECKS:-"0"}
|
||||
|
||||
ICON_ERROR="/usr/share/icons/ubuntu-mono-dark/status/22/system-devices-panel-alert.svg"
|
||||
|
||||
|
||||
LAUNCH_CONFIG='/dockerstartup/redroid_launch_selections.json'
|
||||
# Launch Config Based Workflow
|
||||
if [ -e ${LAUNCH_CONFIG} ]; then
|
||||
ANDROID_VERSION="$(jq -r '.android_version' ${LAUNCH_CONFIG})"
|
||||
fi
|
||||
|
||||
|
||||
function check_modules() {
|
||||
if lsmod | grep -q binder_linux; then
|
||||
echo "binder_linux module is loaded."
|
||||
else
|
||||
msg="Host level module binder_linux is not loaded. Cannot continue.\nSee https://github.com/remote-android/redroid-doc?tab=readme-ov-file#getting-started for more details."
|
||||
echo msg
|
||||
notify-send -u critical -t 0 -i "${ICON_ERROR}" "Redroid Error" "${msg}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for ashmem_linux module
|
||||
if lsmod | grep -q ashmem_linux; then
|
||||
echo "ashmem_linux module is loaded."
|
||||
else
|
||||
msg="Host level module ashmem_linux is not loaded. Cannot continue.\nSee https://github.com/remote-android/redroid-doc?tab=readme-ov-file#getting-started for more details."
|
||||
echo msg
|
||||
notify-send -u critical -t 0 -i "${ICON_ERROR}" "Redroid Error" "${msg}"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
start_android() {
|
||||
sleep 5
|
||||
xfce4-terminal --hide-menubar --command "bash -c \"sudo docker pull redroid/redroid:${ANDROID_VERSION}-latest \""
|
||||
sudo docker run -itd --rm --privileged \
|
||||
--pull always \
|
||||
-v ~/data:/data \
|
||||
-p 5555:5555 \
|
||||
redroid/redroid:${ANDROID_VERSION}-latest \
|
||||
androidboot.redroid_gpu_mode=${REDROID_GPU_GUEST_MODE} \
|
||||
androidboot.redroid_fps=${REDROID_FPS} \
|
||||
androidboot.redroid_width=${REDROID_WIDTH} \
|
||||
androidboot.redroid_height=${REDROID_HEIGHT} \
|
||||
androidboot.redroid_dpi=${REDROID_DPI}
|
||||
sleep 2
|
||||
adb connect localhost:5555
|
||||
sleep 5
|
||||
}
|
||||
start_scrcpy() {
|
||||
|
||||
if [ "$REDROID_SHOW_CONSOLE" == "1" ]; then
|
||||
xfce4-terminal --hide-menubar --command "bash -c \"scrcpy --audio-codec=aac -s localhost:5555 --shortcut-mod=lalt --print-fps --max-fps=${REDROID_FPS} \"" &
|
||||
else
|
||||
scrcpy --audio-codec=aac -s localhost:5555 --shortcut-mod=lalt --print-fps --max-fps=${REDROID_FPS}
|
||||
fi
|
||||
|
||||
}
|
||||
kasm_startup() {
|
||||
if [ -n "$KASM_URL" ] ; then
|
||||
URL=$KASM_URL
|
||||
elif [ -z "$URL" ] ; then
|
||||
URL=$LAUNCH_URL
|
||||
fi
|
||||
|
||||
if [ -z "$DISABLE_CUSTOM_STARTUP" ] || [ -n "$FORCE" ] ; then
|
||||
|
||||
echo "Entering process startup loop"
|
||||
set +x
|
||||
while true
|
||||
do
|
||||
if ! pgrep -x $DOCKER_PGREP > /dev/null
|
||||
then
|
||||
set +e
|
||||
sudo /usr/bin/supervisord -n &
|
||||
set -e
|
||||
if [ "$REDROID_DISABLE_AUTOSTART" == "0" ]; then
|
||||
start_android
|
||||
fi
|
||||
fi
|
||||
if [ "$REDROID_DISABLE_AUTOSTART" == "0" ]; then
|
||||
if ! pgrep -x $SCRCPY_PGREP > /dev/null
|
||||
then
|
||||
start_scrcpy
|
||||
fi
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
set -x
|
||||
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
/usr/bin/filter_ready
|
||||
/usr/bin/desktop_ready
|
||||
|
||||
|
||||
if [ "$REDROID_DISABLE_HOST_CHECKS" == "0" ]; then
|
||||
check_modules
|
||||
fi
|
||||
kasm_startup
|
18
src/ubuntu/install/redroid/install_redroid.sh
Normal file
18
src/ubuntu/install/redroid/install_redroid.sh
Normal file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
ARCH=$(arch | sed 's/x86_64/amd64/g')
|
||||
|
||||
apt-get update
|
||||
apt-get install -y android-tools-adb android-tools-fastboot \
|
||||
ffmpeg libsdl2-2.0-0 adb wget \
|
||||
gcc git pkg-config meson ninja-build libsdl2-dev \
|
||||
libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev \
|
||||
libswresample-dev libusb-1.0-0 libusb-1.0-0-dev jq
|
||||
|
||||
|
||||
mkdir -p /opt/
|
||||
cd /opt/
|
||||
git clone https://github.com/Genymobile/scrcpy
|
||||
cd scrcpy
|
||||
./install_release.sh
|
Loading…
Reference in New Issue
Block a user