Merge branch 'feature/KASM-2969_unityhub' into 'develop'

KASM-2969 Unityhub Image

Closes KASM-2969

See merge request kasm-technologies/internal/workspaces-images!69
This commit is contained in:
Justin Travis 2022-07-24 20:28:55 +00:00
commit ba56c84a95
6 changed files with 166 additions and 4 deletions

View File

@ -60,7 +60,7 @@ variables:
- tracelabs - tracelabs
- ubuntu-focal-dind - ubuntu-focal-dind
- ubuntu-focal-dind-rootless - ubuntu-focal-dind-rootless
- vmware-horizon - unityhub
- zoom - zoom
- zsnes - zsnes
@ -133,7 +133,7 @@ build_app_images:
- aws-autoscale - aws-autoscale
parallel: parallel:
matrix: matrix:
- KASM_IMAGE: [doom, sublime-text, gimp, vs-code, teams, only-office, zoom, signal, steam, postman, insomnia, zsnes, vlc, maltego, telegram, hunchly, java-dev, terminal, vmware-horizon, remmina, rdesktop, discord, libre-office, thunderbird, atom, audacity, deluge, filezilla, inkscape, pinta, qbittorrent, blender] - KASM_IMAGE: [doom, sublime-text, gimp, vs-code, teams, only-office, zoom, signal, steam, postman, insomnia, zsnes, vlc, maltego, telegram, hunchly, java-dev, terminal, remmina, rdesktop, discord, libre-office, thunderbird, atom, audacity, deluge, filezilla, inkscape, pinta, qbittorrent, blender, unityhub]
build_ubuntu_desktop_images: build_ubuntu_desktop_images:
stage: build stage: build
@ -430,7 +430,7 @@ build_schedules_app_images:
- aws-autoscale - aws-autoscale
parallel: parallel:
matrix: matrix:
- KASM_IMAGE: [doom, sublime-text, gimp, vs-code, teams, only-office, zoom, signal, steam, postman, insomnia, zsnes, vlc, maltego, telegram, hunchly, java-dev, terminal, vmware-horizon, remmina, rdesktop, discord, libre-office, thunderbird, atom, audacity, deluge, filezilla, inkscape, pinta, qbittorrent, blender] - KASM_IMAGE: [doom, sublime-text, gimp, vs-code, teams, only-office, zoom, signal, steam, postman, insomnia, zsnes, vlc, maltego, telegram, hunchly, java-dev, terminal, remmina, rdesktop, discord, libre-office, thunderbird, atom, audacity, deluge, filezilla, inkscape, pinta, qbittorrent, blender, unityhub]
build_schedules_ubuntu_desktop_images: build_schedules_ubuntu_desktop_images:
image: ${ORG_NAME}/docker-buildx-private:develop image: ${ORG_NAME}/docker-buildx-private:develop
@ -572,8 +572,8 @@ update_readmes:
- ubuntu-jammy-desktop - ubuntu-jammy-desktop
- ubuntu-focal-dind - ubuntu-focal-dind
- ubuntu-focal-dind-rootless - ubuntu-focal-dind-rootless
- unityhub
- vlc - vlc
- vmware-horizon
- vs-code - vs-code
- zoom - zoom
- zsnes - zsnes

40
dockerfile-kasm-unityhub Normal file
View File

@ -0,0 +1,40 @@
ARG BASE_TAG="develop"
ARG BASE_IMAGE="core-ubuntu-focal"
FROM kasmweb/$BASE_IMAGE:$BASE_TAG
USER root
ENV HOME /home/kasm-default-profile
ENV STARTUPDIR /dockerstartup
ENV INST_SCRIPTS $STARTUPDIR/install
ENV LOCALE_ALL=
ENV LANGUAGE=
WORKDIR $HOME
######### Customize Container Here ###########
# Install Utilities
COPY ./src/ubuntu/install/misc $INST_SCRIPTS/misc/
RUN bash $INST_SCRIPTS/misc/install_tools.sh && rm -rf $INST_SCRIPTS/misc/
# Install Google Chrome
COPY ./src/ubuntu/install/chrome $INST_SCRIPTS/chrome/
RUN bash $INST_SCRIPTS/chrome/install_chrome.sh && rm -rf $INST_SCRIPTS/chrome/
# Install Unity
COPY ./src/ubuntu/install/unityhub $INST_SCRIPTS/unityhub/
RUN bash $INST_SCRIPTS/unityhub/install_unityhub.sh && rm -rf $INST_SCRIPTS/unityhub/
COPY ./src/ubuntu/install/unityhub/custom_startup.sh $STARTUPDIR/custom_startup.sh
RUN chmod +x $STARTUPDIR/custom_startup.sh
RUN chmod 755 $STARTUPDIR/custom_startup.sh
######### End Customizations ###########
RUN chown 1000:0 $HOME
RUN $STARTUPDIR/set_user_permission.sh $HOME
ENV HOME /home/kasm-user
WORKDIR $HOME
RUN mkdir -p $HOME && chown -R 1000:0 $HOME
USER 1000

11
docs/unityhub/README.md Normal file
View File

@ -0,0 +1,11 @@
# About This Image
This Image contains a browser-accessible version of [Unity Hub](https://unity.com/).
![Screenshot][Image_Screenshot]
[Image_Screenshot]: https://5856039.fs1.hubspotusercontent-na1.net/hubfs/5856039/dockerhub/image-screenshots/unityhub.png "Image Screenshot"
# Environment Variables
* `APP_ARGS` - Additional arguments to pass to the application when launched.

View File

@ -0,0 +1 @@
Unity Hub for Kasm Workspaces

View File

@ -0,0 +1,84 @@
#!/usr/bin/env bash
set -ex
START_COMMAND="/opt/unityhub/unityhub"
PGREP="unityhub-bin"
export MAXIMIZE="false"
export MAXIMIZE_NAME="Unity"
MAXIMIZE_SCRIPT=$STARTUPDIR/maximize_window.sh
DEFAULT_ARGS=" --no-sandbox"
ARGS=${APP_ARGS:-$DEFAULT_ARGS}
options=$(getopt -o gau: -l go,assign,url: -n "$0" -- "$@") || exit
eval set -- "$options"
while [[ $1 != -- ]]; do
case $1 in
-g|--go) GO='true'; shift 1;;
-a|--assign) ASSIGN='true'; shift 1;;
-u|--url) OPT_URL=$2; shift 2;;
*) echo "bad option: $1" >&2; exit 1;;
esac
done
shift
# Process non-option arguments.
for arg; do
echo "arg! $arg"
done
FORCE=$2
kasm_exec() {
if [ -n "$OPT_URL" ] ; then
URL=$OPT_URL
elif [ -n "$1" ] ; then
URL=$1
fi
# Since we are execing into a container that already has the browser running from startup,
# when we don't have a URL to open we want to do nothing. Otherwise a second browser instance would open.
if [ -n "$URL" ] ; then
/usr/bin/filter_ready
/usr/bin/desktop_ready
bash ${MAXIMIZE_SCRIPT} &
$START_COMMAND $ARGS $OPT_URL
else
echo "No URL specified for exec command. Doing nothing."
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 $PGREP > /dev/null
then
/usr/bin/filter_ready
/usr/bin/desktop_ready
set +e
bash ${MAXIMIZE_SCRIPT} &
$START_COMMAND $ARGS $URL
set -e
fi
sleep 1
done
set -x
fi
}
if [ -n "$GO" ] || [ -n "$ASSIGN" ] ; then
kasm_exec
else
kasm_startup
fi

View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Adapted from https://docs.unity3d.com/hub/manual/InstallHub.html#install-hub-linux
SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
set -ex
sh -c 'echo "deb https://hub.unity3d.com/linux/repos/deb stable main" > /etc/apt/sources.list.d/unityhub.list'
wget -qO - https://hub.unity3d.com/linux/keys/public | apt-key add -
apt-get update
apt-get install -y unityhub
sed -i 's,/opt/unityhub/unityhub,/opt/unityhub/unityhub --no-sandbox,g' /usr/share/applications/unityhub.desktop
cp /usr/share/applications/unityhub.desktop $HOME/Desktop/
chmod +x $HOME/Desktop/unityhub.desktop
chown 1000:1000 $HOME/Desktop/unityhub.desktop
# Example for pre-installing a unity Editor
#mkdir -p $HOME/Unity/Hub/Editor/2021.3.6f1
#cd /tmp/
#wget -q https://download.unity3d.com/download_unity/7da38d85baf6/UnitySetup-2021.3.6f1 -O UnitySetup
#chmod +x ./UnitySetup
#yes | ./UnitySetup -u -l $HOME/Unity/Hub/Editor/2021.3.6f1
#rm /tmp/UnitySetup
#chown -R 1000:1000 $HOME/Unity