mirror of
https://github.com/kasmtech/workspaces-images.git
synced 2024-11-21 15:43:09 +01:00
KASM-1209 Redroid Images with Android Studio
This commit is contained in:
parent
26ad957d24
commit
efa319d2eb
@ -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"]
|
11
docs/redroid/README.md
Normal file
11
docs/redroid/README.md
Normal file
@ -0,0 +1,11 @@
|
||||
# About This Image
|
||||
|
||||
This Image contains a browser-accessible version of [Redroid](https://github.com/remote-android/redroid-doc).
|
||||
|
||||
![Screenshot][Image_Screenshot]
|
||||
|
||||
[Image_Screenshot]: https://f.hubspotusercontent30.net/hubfs/5856039/dockerhub/image-screenshots/redroid.png "Image Screenshot"
|
||||
|
||||
# Environment Variables
|
||||
|
||||
* `APP_ARGS` - Additional arguments to pass to the application when launched.
|
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/5361455650" target="_blank"><img src="https://info.kasmweb.com/hubfs/dockerhub/GIFs/qbittorrent.gif" width="640" height="360"></a>
|
||||
|
||||
**Launch a real-time demo in a new browser window:** <a href="https://app.kasmweb.com/#/cast/5361455650" target="_blank">Live Demo</a>.
|
||||
|
||||
<a href="https://app.kasmweb.com/#/cast/5361455650" target="_blank"><img src="https://5856039.fs1.hubspotusercontent-na1.net/hub/5856039/hubfs/dockerhub/casting-buttons/Qbittorrent.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
|
43
src/ubuntu/install/android_studio/install_android_studio.sh
Normal file
43
src/ubuntu/install/android_studio/install_android_studio.sh
Normal file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
|
||||
|
||||
ARCH=$(arch | sed 's/aarch64/arm64/g' | sed 's/x86_64/amd64/g')
|
||||
if [ "$ARCH" == "arm64" ] ; then
|
||||
echo "Chrome not supported on arm64, skipping Chrome 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
|
||||
|
||||
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
|
98
src/ubuntu/install/redroid/custom_startup.sh
Normal file
98
src/ubuntu/install/redroid/custom_startup.sh
Normal file
@ -0,0 +1,98 @@
|
||||
#!/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:-"60"}
|
||||
REDROID_WIDTH=${REDROID_WIDTH:-"720"}
|
||||
REDROID_HEIGHT=${REDROID_HEIGHT:-"1280"}
|
||||
REDROID_DPI=${REDROID_DPI:-"320"}
|
||||
REDROID_SHOW_CONSOLE=${REDROID_SHOW_CONSOLE:-"1"}
|
||||
|
||||
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 audio_patch() {
|
||||
# The devices start with audio quite low
|
||||
set +e
|
||||
for ((i=1; i<=10; i++)); do
|
||||
adb -s localhost:5555 shell input keyevent KEYCODE_VOLUME_UP &
|
||||
sleep 0.2
|
||||
done
|
||||
set -e
|
||||
|
||||
}
|
||||
|
||||
start_android() {
|
||||
/usr/bin/filter_ready
|
||||
/usr/bin/desktop_ready
|
||||
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
|
||||
audio_patch
|
||||
}
|
||||
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
|
||||
/usr/bin/filter_ready
|
||||
/usr/bin/desktop_ready
|
||||
set +e
|
||||
sudo /usr/bin/supervisord -n &
|
||||
set -e
|
||||
start_android
|
||||
fi
|
||||
if ! pgrep -x $SCRCPY_PGREP > /dev/null
|
||||
then
|
||||
/usr/bin/filter_ready
|
||||
/usr/bin/desktop_ready
|
||||
start_scrcpy
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
set -x
|
||||
|
||||
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