From efa319d2ebdaac2488b9ce810369e0424a137726 Mon Sep 17 00:00:00 2001 From: Justin Travis Date: Thu, 28 Dec 2023 16:19:09 -0500 Subject: [PATCH] KASM-1209 Redroid Images with Android Studio --- ci-scripts/template-vars.yaml | 14 +++ dockerfile-kasm-redroid | 55 +++++++++++ docs/redroid/README.md | 11 +++ docs/redroid/demo.txt | 9 ++ docs/redroid/description.txt | 1 + .../android_studio/install_android_studio.sh | 43 ++++++++ src/ubuntu/install/redroid/custom_startup.sh | 98 +++++++++++++++++++ src/ubuntu/install/redroid/install_redroid.sh | 18 ++++ 8 files changed, 249 insertions(+) create mode 100644 dockerfile-kasm-redroid create mode 100644 docs/redroid/README.md create mode 100644 docs/redroid/demo.txt create mode 100644 docs/redroid/description.txt create mode 100644 src/ubuntu/install/android_studio/install_android_studio.sh create mode 100644 src/ubuntu/install/redroid/custom_startup.sh create mode 100644 src/ubuntu/install/redroid/install_redroid.sh diff --git a/ci-scripts/template-vars.yaml b/ci-scripts/template-vars.yaml index fe446cc..7c665ae 100644 --- a/ci-scripts/template-vars.yaml +++ b/ci-scripts/template-vars.yaml @@ -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 diff --git a/dockerfile-kasm-redroid b/dockerfile-kasm-redroid new file mode 100644 index 0000000..9d25435 --- /dev/null +++ b/dockerfile-kasm-redroid @@ -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"] \ No newline at end of file diff --git a/docs/redroid/README.md b/docs/redroid/README.md new file mode 100644 index 0000000..97850a5 --- /dev/null +++ b/docs/redroid/README.md @@ -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. diff --git a/docs/redroid/demo.txt b/docs/redroid/demo.txt new file mode 100644 index 0000000..8064874 --- /dev/null +++ b/docs/redroid/demo.txt @@ -0,0 +1,9 @@ +# Live Demo + + + +**Launch a real-time demo in a new browser window:** Live Demo. + + + +∗*Note: Demo is limited to 3 minutes and has upload/downloads restricted for security purposes.* diff --git a/docs/redroid/description.txt b/docs/redroid/description.txt new file mode 100644 index 0000000..0a86cd8 --- /dev/null +++ b/docs/redroid/description.txt @@ -0,0 +1 @@ +Redroid (Remote-Android) for Kasm Workspaces diff --git a/src/ubuntu/install/android_studio/install_android_studio.sh b/src/ubuntu/install/android_studio/install_android_studio.sh new file mode 100644 index 0000000..effb50d --- /dev/null +++ b/src/ubuntu/install/android_studio/install_android_studio.sh @@ -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 < /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 diff --git a/src/ubuntu/install/redroid/install_redroid.sh b/src/ubuntu/install/redroid/install_redroid.sh new file mode 100644 index 0000000..198cf36 --- /dev/null +++ b/src/ubuntu/install/redroid/install_redroid.sh @@ -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 \ No newline at end of file