diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index eae32a3..11833bf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -35,6 +35,26 @@ build_ubuntu_bionic: tags: - aws-autoscale +build_ubuntu_focal: + stage: build + image: ${ORG_NAME}/docker-buildx-private:develop + variables: + BUILD_PLATFORMS: "linux/amd64,linux/arm64" + script: + # get qemu ready + - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + # prep the buildx env + - docker buildx create --use + # build for multiple architectures + - docker buildx build --push --platform $BUILD_PLATFORMS -t ${ORG_NAME}/core-ubuntu-focal-private:$SANITIZED_BRANCH -t ${ORG_NAME}/core-ubuntu-focal-private:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/core-ubuntu-focal:$SANITIZED_BRANCH -t ${ORG_NAME}/core-ubuntu-focal:$SANITIZED_ROLLING_BRANCH --build-arg START_PULSEAUDIO=1 --build-arg BASE_IMAGE="ubuntu:20.04" --build-arg START_XFCE4=1 --build-arg BG_IMG=bg_focal.png -f dockerfile-kasm-core . + only: + - develop + - /^release\/.*$/ + except: + - schedules + tags: + - aws-autoscale + build_cuda_bionic: stage: build script: @@ -49,6 +69,20 @@ build_cuda_bionic: except: - schedules +build_cuda_focal: + stage: build + script: + - docker build -t ${ORG_NAME}/core-cuda-focal-private:$SANITIZED_BRANCH -t ${ORG_NAME}/core-cuda-focal-private:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/core-cuda-focal:$SANITIZED_BRANCH -t ${ORG_NAME}/core-cuda-focal:$SANITIZED_ROLLING_BRANCH --build-arg START_PULSEAUDIO=1 --build-arg BASE_IMAGE="nvidia/cuda:11.6.0-devel-ubuntu20.04" --build-arg START_XFCE4=1 --build-arg BG_IMG=bg_focal.png -f dockerfile-kasm-core . + - docker push ${ORG_NAME}/core-cuda-focal-private:$SANITIZED_BRANCH + - docker push ${ORG_NAME}/core-cuda-focal-private:$SANITIZED_ROLLING_BRANCH + - docker push ${ORG_NAME}/core-cuda-focal:$SANITIZED_BRANCH + - docker push ${ORG_NAME}/core-cuda-focal:$SANITIZED_ROLLING_BRANCH + only: + - develop + - /^release\/.*$/ + except: + - schedules + build_nvidia_focal: stage: build image: ${ORG_NAME}/docker-buildx-private:develop @@ -60,7 +94,7 @@ build_nvidia_focal: # prep the buildx env - docker buildx create --use # build for multiple architectures - - docker buildx build --push --platform $BUILD_PLATFORMS -t ${ORG_NAME}/core-nvidia-focal-private:$SANITIZED_BRANCH -t ${ORG_NAME}/core-nvidia-focal-private:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/core-nvidia-focal:$SANITIZED_BRANCH -t ${ORG_NAME}/core-nvidia-focal:$SANITIZED_ROLLING_BRANCH --build-arg BASE_IMAGE="ubuntu:20.04" --build-arg BG_IMG=bg_bionic.png -f dockerfile-kasm-core-nvidia . + - docker buildx build --push --platform $BUILD_PLATFORMS -t ${ORG_NAME}/core-nvidia-focal-private:$SANITIZED_BRANCH -t ${ORG_NAME}/core-nvidia-focal-private:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/core-nvidia-focal:$SANITIZED_BRANCH -t ${ORG_NAME}/core-nvidia-focal:$SANITIZED_ROLLING_BRANCH --build-arg START_PULSEAUDIO=1 --build-arg BASE_IMAGE="ubuntu:20.04" --build-arg BG_IMG=bg_focal.png -f dockerfile-kasm-core-nvidia . tags: - aws-autoscale only: @@ -83,6 +117,23 @@ build_remnux_bionic: except: - schedules +build_remnux_focal: + stage: build + script: + - docker build -t ${ORG_NAME}/core-remnux-focal-private:$SANITIZED_BRANCH -t ${ORG_NAME}/core-remnux-focal-private:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/core-remnux-focal:$SANITIZED_BRANCH -t ${ORG_NAME}/core-remnux-focal:$SANITIZED_ROLLING_BRANCH --build-arg START_PULSEAUDIO=1 --build-arg BASE_IMAGE="remnux/remnux-distro:focal" --build-arg START_XFCE4=1 --build-arg BG_IMG=bg_remnux.png --build-arg EXTRA_SH=remnux.sh -f dockerfile-kasm-core . + - docker push ${ORG_NAME}/core-remnux-focal-private:$SANITIZED_BRANCH + - docker push ${ORG_NAME}/core-remnux-focal-private:$SANITIZED_ROLLING_BRANCH + - docker push ${ORG_NAME}/core-remnux-focal:$SANITIZED_BRANCH + - docker push ${ORG_NAME}/core-remnux-focal:$SANITIZED_ROLLING_BRANCH + only: + - develop + - /^release\/.*$/ + except: + - schedules + tags: + - aws-autoscale + + build_kali_rolling: stage: build image: ${ORG_NAME}/docker-buildx-private:develop @@ -137,6 +188,23 @@ build_ubuntu_bionic_dev: tags: - aws-autoscale +build_ubuntu_focal_dev: + image: ${ORG_NAME}/docker-buildx-private:develop + stage: build + variables: + BUILD_PLATFORMS: "linux/amd64,linux/arm64" + script: + # get qemu ready + - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + # prep the buildx env + - docker buildx create --use + # build for multiple architectures + - docker buildx build --push --platform $BUILD_PLATFORMS -t ${ORG_NAME}/core-ubuntu-focal-private:$SANITIZED_BRANCH --build-arg START_PULSEAUDIO=1 --build-arg BASE_IMAGE="ubuntu:20.04" --build-arg START_XFCE4=1 --build-arg BG_IMG=bg_focal.png -f dockerfile-kasm-core . + except: + - develop + - /^release\/.*$/ + tags: + - aws-autoscale build_cuda_bionic_dev: stage: build @@ -147,6 +215,15 @@ build_cuda_bionic_dev: - develop - /^release\/.*$/ +build_cuda_focal_dev: + stage: build + script: + - docker build -t ${ORG_NAME}/core-cuda-focal-private:$SANITIZED_BRANCH --build-arg START_PULSEAUDIO=1 --build-arg BASE_IMAGE="nvidia/cuda:11.6.0-devel-ubuntu20.04" --build-arg START_XFCE4=1 --build-arg BG_IMG=bg_focal.png -f dockerfile-kasm-core . + - docker push ${ORG_NAME}/core-cuda-focal-private:$SANITIZED_BRANCH + except: + - develop + - /^release\/.*$/ + build_nvidia_focal_dev: stage: build image: ${ORG_NAME}/docker-buildx-private:develop @@ -174,6 +251,17 @@ build_remnux_bionic_dev: - develop - /^release\/.*$/ +build_remnux_focal_dev: + stage: build + script: + - docker build -t ${ORG_NAME}/core-remnux-focal-private:$SANITIZED_BRANCH --build-arg START_PULSEAUDIO=1 --build-arg BASE_IMAGE="remnux/remnux-distro:focal" --build-arg START_XFCE4=1 --build-arg BG_IMG=bg_remnux.png --build-arg EXTRA_SH=remnux.sh -f dockerfile-kasm-core . + - docker push ${ORG_NAME}/core-remnux-focal-private:$SANITIZED_BRANCH + tags: + - aws-autoscale + except: + - develop + - /^release\/.*$/ + build_kali_rolling_dev: stage: build image: ${ORG_NAME}/docker-buildx-private:develop @@ -219,6 +307,23 @@ build_ubuntu_bionic_scheduled: tags: - aws-autoscale +build_ubuntu_focal_scheduled: + stage: build + image: ${ORG_NAME}/docker-buildx-private:develop + variables: + BUILD_PLATFORMS: "linux/amd64,linux/arm64" + script: + # get qemu ready + - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + # prep the buildx env + - docker buildx create --use + # build for multiple architectures + - docker buildx build --push --platform $BUILD_PLATFORMS -t ${ORG_NAME}/core-ubuntu-focal-private:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/core-ubuntu-focal:$SANITIZED_ROLLING_BRANCH --build-arg START_PULSEAUDIO=1 --build-arg BASE_IMAGE="ubuntu:20.04" --build-arg START_XFCE4=1 --build-arg BG_IMG=bg_focal.png -f dockerfile-kasm-core . + only: + - schedules + tags: + - aws-autoscale + build_cuda_bionic_schedules: stage: build script: @@ -228,6 +333,15 @@ build_cuda_bionic_schedules: only: - schedules +build_cuda_focal_schedules: + stage: build + script: + - docker build -t ${ORG_NAME}/core-cuda-focal-private:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/core-cuda-focal:$SANITIZED_ROLLING_BRANCH --build-arg START_PULSEAUDIO=1 --build-arg BASE_IMAGE="nvidia/cuda:11.6.0-devel-ubuntu20.04" --build-arg START_XFCE4=1 --build-arg BG_IMG=bg_focal.png -f dockerfile-kasm-core . + - docker push ${ORG_NAME}/core-cuda-focal-private:$SANITIZED_ROLLING_BRANCH + - docker push ${ORG_NAME}/core-cuda-focal:$SANITIZED_ROLLING_BRANCH + only: + - schedules + build_nvidia_focal_schedules: stage: build image: ${ORG_NAME}/docker-buildx-private:develop @@ -254,6 +368,17 @@ build_remnux_bionic_schedules: only: - schedules +build_remnux_focal_schedules: + stage: build + script: + - docker build -t ${ORG_NAME}/core-remnux-focal-private:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/core-remnux-focal:$SANITIZED_ROLLING_BRANCH --build-arg START_PULSEAUDIO=1 --build-arg BASE_IMAGE="remnux/remnux-distro:focal" --build-arg START_XFCE4=1 --build-arg BG_IMG=bg_remnux.png --build-arg EXTRA_SH=remnux.sh -f dockerfile-kasm-core . + - docker push ${ORG_NAME}/core-remnux-focal-private:$SANITIZED_ROLLING_BRANCH + - docker push ${ORG_NAME}/core-remnux-focal:$SANITIZED_ROLLING_BRANCH + tags: + - aws-autoscale + only: + - schedules + build_kali_rolling_schedules: stage: build image: ${ORG_NAME}/docker-buildx-private:develop @@ -297,4 +422,4 @@ update_readmes: - $README_PASSWORD parallel: matrix: - - KASM_IMAGE: [core-centos-7, core-kali-rolling, core-remnux-bionic, core-cuda-bionic, core-ubuntu-bionic, core-nvidia-focal] + - KASM_IMAGE: [core-centos-7, core-kali-rolling, core-remnux-bionic, core-remnux-focal, core-cuda-bionic, core-cuda-focal, core-ubuntu-bionic, core-ubuntu-focal, core-nvidia-focal] diff --git a/README.md b/README.md index dd5ccc4..2e3f438 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ ![Logo][logo] # Workspaces Core Images This repository contains the base or **"Core"** images from which all other Workspaces images are derived. -These images are based off popular linux distributions and container the wiring necessary to work within the Kasm platform. +These images are based off popular linux distributions and contain the wiring necessary to work within the Kasm platform. -While these image are primarily built to run inside the Kasm platform, it can also be executed manually. Please note that certain functionality, such as audio, uploads, downloads, and microphone passthrough are only available within the Kasm platform. +While these images are primarily built to run inside the Kasm platform, they can also be executed manually. Please note that certain functionality, such as audio, uploads, downloads, and microphone passthrough are only available within the Kasm platform. ``` sudo docker run --rm -it --shm-size=512m -p 6901:6901 -e VNC_PW=password kasmweb/: diff --git a/dockerfile-kasm-core b/dockerfile-kasm-core index 1c4620c..5b2a55c 100644 --- a/dockerfile-kasm-core +++ b/dockerfile-kasm-core @@ -1,14 +1,10 @@ -ARG BASE_IMAGE="ubuntu:18.04" +ARG BASE_IMAGE="ubuntu:20.04" FROM $BASE_IMAGE AS install_tools ARG DISTRO=ubuntu -MAINTAINER Kasm Tech "info@kasmweb.com" +LABEL "org.opencontainers.image.authors"='Kasm Tech "info@kasmweb.com"' LABEL "com.kasmweb.image"="true" -### Install common tools -COPY ./src/ubuntu/install/tools $INST_SCRIPTS/tools/ -RUN bash $INST_SCRIPTS/tools/install_tools.sh && rm -rf $INST_SCRIPTS/tools/ - ### Environment config ARG START_XFCE4=0 ARG START_PULSEAUDIO=0 @@ -54,6 +50,15 @@ EXPOSE $VNC_PORT \ WORKDIR $HOME RUN mkdir -p $HOME/Desktop +### Install common tools +COPY ./src/ubuntu/install/tools $INST_SCRIPTS/tools/ +RUN bash $INST_SCRIPTS/tools/install_tools.sh && rm -rf $INST_SCRIPTS/tools/ + +### Install wmctrl needed for the maximize script +RUN apt install wmctrl + +### Copy over the maximization script to our startup dir for use by app images. +COPY ./src/ubuntu/install/maximize_script $STARTUPDIR/ ### Install custom fonts COPY ./src/ubuntu/install/fonts $INST_SCRIPTS/fonts/ diff --git a/dockerfile-kasm-core-nvidia b/dockerfile-kasm-core-nvidia index d80eeb9..a16c280 100644 --- a/dockerfile-kasm-core-nvidia +++ b/dockerfile-kasm-core-nvidia @@ -13,7 +13,7 @@ RUN tar -xzf kasm-squid-builder_ubuntu.tar.gz -C / FROM install_tools -MAINTAINER Kasm Tech "info@kasmweb.com" +LABEL "org.opencontainers.image.authors"='Kasm Tech "info@kasmweb.com"' LABEL "com.kasmweb.image"="true" LABEL "com.kasmweb.gpu_acceleration_egl"="nvidia" @@ -62,6 +62,12 @@ EXPOSE $VNC_PORT \ WORKDIR $HOME RUN mkdir -p $HOME/Desktop +### Install wmctrl needed for the maximize script +RUN apt install wmctrl + +### Copy over the maximization script to our startup dir for use by app images. +COPY ./src/ubuntu/install/maximize_script $STARTUPDIR/ + # NVIDIA SETUP RUN echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && \ echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf diff --git a/docs/core-cuda-focal/README.md b/docs/core-cuda-focal/README.md new file mode 100644 index 0000000..dde7c99 --- /dev/null +++ b/docs/core-cuda-focal/README.md @@ -0,0 +1,9 @@ +# About This Image + +This image contains a browser-accessible version of Ubuntu Focal including the CUDA toolkit. + +This image is used by our open-source containerized [Machine Learning Desktop](https://github.com/kasmtech/workspaces-machine-learning) and our [Data Science Desktop](https://github.com/kasmtech/workspaces-data-science). The core image should be used as a base to create your own derivative images, or you can modify our ML or data science images to meet your needs. All images are intended to be used with the NVIDIA container toolkit to pass GPU capabilities into the containerized desktop, which is pre-loaded with your favorite development and data science tools and libraries. + +![Screenshot][Image_Screenshot] + +[Image_Screenshot]: https://f.hubspotusercontent30.net/hubfs/5856039/dockerhub/image-screenshots/core-cuda-focal.png "Image Screenshot" diff --git a/docs/core-cuda-focal/description.txt b/docs/core-cuda-focal/description.txt new file mode 100644 index 0000000..4f219f6 --- /dev/null +++ b/docs/core-cuda-focal/description.txt @@ -0,0 +1 @@ +CUDA toolkit base image for Kasm Workspaces diff --git a/docs/core-remnux-focal/README.md b/docs/core-remnux-focal/README.md new file mode 100644 index 0000000..2376ef4 --- /dev/null +++ b/docs/core-remnux-focal/README.md @@ -0,0 +1,7 @@ +# About This Image + +This image contains a browser-accessible version of REMnux. + +![Screenshot][Image_Screenshot] + +[Image_Screenshot]: https://f.hubspotusercontent30.net/hubfs/5856039/dockerhub/image-screenshots/core-remnux-focal.png "Image Screenshot" \ No newline at end of file diff --git a/docs/core-remnux-focal/description.txt b/docs/core-remnux-focal/description.txt new file mode 100644 index 0000000..ec50c83 --- /dev/null +++ b/docs/core-remnux-focal/description.txt @@ -0,0 +1 @@ +REMnux base image for Kasm Workspaces \ No newline at end of file diff --git a/docs/core-ubuntu-focal/README.md b/docs/core-ubuntu-focal/README.md new file mode 100644 index 0000000..688e287 --- /dev/null +++ b/docs/core-ubuntu-focal/README.md @@ -0,0 +1,7 @@ +# About This Image + +This image contains a browser-accessible version of Ubuntu Focal. + +![Screenshot][Image_Screenshot] + +[Image_Screenshot]: https://f.hubspotusercontent30.net/hubfs/5856039/dockerhub/image-screenshots/core-ubuntu-focal.png "Image Screenshot" \ No newline at end of file diff --git a/docs/core-ubuntu-focal/description.txt b/docs/core-ubuntu-focal/description.txt new file mode 100644 index 0000000..a74c3bd --- /dev/null +++ b/docs/core-ubuntu-focal/description.txt @@ -0,0 +1 @@ +Ubuntu Focal base image for Kasm Workspaces diff --git a/src/common/resources/images/bg_focal.png b/src/common/resources/images/bg_focal.png new file mode 100644 index 0000000..68a0b5d Binary files /dev/null and b/src/common/resources/images/bg_focal.png differ diff --git a/src/ubuntu/install/kasm_vnc/install_kasm_vnc.sh b/src/ubuntu/install/kasm_vnc/install_kasm_vnc.sh index b3e5d69..a653242 100644 --- a/src/ubuntu/install/kasm_vnc/install_kasm_vnc.sh +++ b/src/ubuntu/install/kasm_vnc/install_kasm_vnc.sh @@ -21,9 +21,9 @@ COMMIT_ID_SHORT=$(echo "${COMMIT_ID}" | cut -c1-6) if [ "${DISTRO}" == "kali" ] ; then if [[ "$(arch)" =~ ^x86_64$ ]] ; then - BUILD_URL="https://kasmweb-build-artifacts.s3.amazonaws.com/kasmvnc/${COMMIT_ID}/kasmvncserver_kali-rolling_0.9.3_${BRANCH}_${COMMIT_ID_SHORT}_amd64.deb" + BUILD_URL="https://kasmweb-build-artifacts.s3.amazonaws.com/kasmvnc/${COMMIT_ID}/kasmvncserver_kali-rolling_0.9.3_${BRANCH}_${COMMIT_ID_SHORT}_amd64.deb" else - BUILD_URL="https://kasmweb-build-artifacts.s3.amazonaws.com/kasmvnc/${COMMIT_ID}/kasmvncserver_kali-rolling_0.9.3_${BRANCH}_${COMMIT_ID_SHORT}_arm64.deb" + BUILD_URL="https://kasmweb-build-artifacts.s3.amazonaws.com/kasmvnc/${COMMIT_ID}/kasmvncserver_kali-rolling_0.9.3_${BRANCH}_${COMMIT_ID_SHORT}_arm64.deb" fi elif [ "${DISTRO}" == "centos" ] ; then BUILD_URL="https://kasmweb-build-artifacts.s3.amazonaws.com/kasmvnc/${COMMIT_ID}/output/centos_core/kasmvncserver-0.9.1~beta-1.el7.x86_64.rpm" @@ -34,7 +34,7 @@ else elif [ "${UBUNTU_CODENAME}" == "bionic" ] ; then BUILD_URL="https://kasmweb-build-artifacts.s3.amazonaws.com/kasmvnc/${COMMIT_ID}/kasmvncserver_${UBUNTU_CODENAME}_0.9.3_${BRANCH}_${COMMIT_ID_SHORT}_libjpeg-turbo-latest_amd64.deb" else - BUILD_URL="https://kasmweb-build-artifacts.s3.amazonaws.com/kasmvnc/${COMMIT_ID}/kasmvncserver_${UBUNTU_CODENAME}_0.9.3_${BRANCH}_${COMMIT_ID_SHORT}_amd64.deb" + BUILD_URL="https://kasmweb-build-artifacts.s3.amazonaws.com/kasmvnc/${COMMIT_ID}/kasmvncserver_${UBUNTU_CODENAME}_0.9.3_${BRANCH}_${COMMIT_ID_SHORT}_amd64.deb" fi fi @@ -46,6 +46,7 @@ if [ "${DISTRO}" == "centos" ] ; then rm kasmvncserver.rpm else if [[ "${UBUNTU_CODENAME}" = "bionic" ]] && [[ ! "$BUILD_ARCH" =~ ^aarch64$ ]] ; then + # We need to install libjpeg-turbo because the version that comes with bionic is quite old and has performance issues. install_libjpeg_turbo fi diff --git a/src/ubuntu/install/maximize_script/maximize_window.sh b/src/ubuntu/install/maximize_script/maximize_window.sh new file mode 100644 index 0000000..0758923 --- /dev/null +++ b/src/ubuntu/install/maximize_script/maximize_window.sh @@ -0,0 +1,39 @@ +# MAXIMIZE and MAXIMIZE_NAME are exported by the calling script +# This script will check against the container OS to do the right thing. + +# Array of codenames that support maximus +MAXIMUS_CODENAMES=("bionic") +# Array of codenames that support wmctrl +WMCTRL_CODENAMES=("focal") + +maximize_window(){ + set +e + if [[ ${MAXIMIZE} == 'true' ]] ; then + if [[ ${MAXIMUS_CODENAMES[*]} =~ $(lsb_release -cs) ]] ; then + # only start maximus if it isn't already running + if ! pgrep -x maximus > /dev/null + then + maximus & + fi + fi + if [[ ${WMCTRL_CODENAMES[*]} =~ $(lsb_release -cs) ]] ; then + while true; do + end=$((SECONDS+60)) + while [ $SECONDS -lt $end ]; do + windows=$(wmctrl -l) + if [[ "$windows" =~ "${MAXIMIZE_NAME}" ]]; + then + echo "Found ${MAXIMIZE_NAME}, maximizing" + wmctrl -r "${MAXIMIZE_NAME}" -b add,maximized_vert,maximized_horz + break; + fi + sleep 1 + done + sleep 10 + done + fi + fi + set -e +} + +maximize_window \ No newline at end of file diff --git a/src/ubuntu/install/tools/install_tools.sh b/src/ubuntu/install/tools/install_tools.sh index 5ff80c5..d906e57 100644 --- a/src/ubuntu/install/tools/install_tools.sh +++ b/src/ubuntu/install/tools/install_tools.sh @@ -9,6 +9,8 @@ if [ "${DISTRO}" == "centos" ] ; then rm wmctrl*.rpm else apt-get update + # Update tzdata noninteractive (otherwise our script is hung on user input later). + DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y install tzdata apt-get install -y vim wget net-tools locales bzip2 wmctrl software-properties-common mesa-utils apt-get clean -y