diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e091356..d2fffa5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -51,12 +51,17 @@ build_cuda_bionic: build_nvidia_focal: stage: build + image: ${ORG_NAME}/docker-buildx-private:develop + image: ${ORG_NAME}/docker-buildx-private:develop script: - - docker build -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 push ${ORG_NAME}/core-nvidia-focal-private:$SANITIZED_BRANCH - - docker push ${ORG_NAME}/core-nvidia-focal-private:$SANITIZED_ROLLING_BRANCH - - docker push ${ORG_NAME}/core-nvidia-focal:$SANITIZED_BRANCH - - docker push ${ORG_NAME}/core-nvidia-focal:$SANITIZED_ROLLING_BRANCH + # 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-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 . + tags: + - aws-autoscale only: - develop - /^release\/.*$/ @@ -139,9 +144,18 @@ build_cuda_bionic_dev: build_nvidia_focal_dev: stage: build + image: ${ORG_NAME}/docker-buildx-private:develop + variables: + BUILD_PLATFORMS: "linux/amd64,linux/arm64" script: - - docker build -t ${ORG_NAME}/core-nvidia-focal-private:$SANITIZED_BRANCH --build-arg BASE_IMAGE="ubuntu:20.04" --build-arg BG_IMG=bg_bionic.png -f dockerfile-kasm-core-nvidia . - - docker push ${ORG_NAME}/core-nvidia-focal-private:$SANITIZED_BRANCH + # 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-nvidia-focal-private:$SANITIZED_BRANCH --build-arg BASE_IMAGE="ubuntu:20.04" --build-arg BG_IMG=bg_bionic.png -f dockerfile-kasm-core-nvidia . + tags: + - aws-autoscale except: - develop - /^release\/.*$/ @@ -204,10 +218,18 @@ build_cuda_bionic_schedules: build_nvidia_focal_schedules: stage: build + image: ${ORG_NAME}/docker-buildx-private:develop + variables: + BUILD_PLATFORMS: "linux/amd64,linux/arm64" script: - - docker build -t ${ORG_NAME}/core-nvidia-focal-private:$SANITIZED_ROLLING_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 push ${ORG_NAME}/core-nvidia-focal-private:$SANITIZED_ROLLING_BRANCH - - docker push ${ORG_NAME}/core-nvidia-focal:$SANITIZED_ROLLING_BRANCH + # 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-nvidia-focal-private:$SANITIZED_ROLLING_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 . + tags: + - aws-autoscale only: - schedules diff --git a/dockerfile-kasm-core-nvidia b/dockerfile-kasm-core-nvidia index e5c5c8e..a8903d0 100644 --- a/dockerfile-kasm-core-nvidia +++ b/dockerfile-kasm-core-nvidia @@ -66,19 +66,6 @@ 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 ENV LD_LIBRARY_PATH /usr/lib/x86_64-linux-gnu:/usr/lib/i386-linux-gnu${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}:/usr/local/nvidia/lib:/usr/local/nvidia/lib64 ENV NVIDIA_DRIVER_CAPABILITIES=${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics,compat32,utility -RUN dpkg --add-architecture i386 && \ - apt-get update && apt-get install -y --no-install-recommends \ - libxau6 libxau6:i386 \ - libxdmcp6 libxdmcp6:i386 \ - libxcb1 libxcb1:i386 \ - libxext6 libxext6:i386 \ - libx11-6 libx11-6:i386 -RUN apt-get update && apt-get install -y --no-install-recommends \ - libglvnd0 libglvnd0:i386 \ - libgl1 libgl1:i386 \ - libglx0 libglx0:i386 \ - libegl1 libegl1:i386 \ - libgles2 libgles2:i386 COPY src/ubuntu/install/nvidia/10_nvidia.json /usr/share/glvnd/egl_vendor.d/10_nvidia.json ### Install custom fonts diff --git a/src/common/startup_scripts/vnc_startup.sh b/src/common/startup_scripts/vnc_startup.sh index fbc2976..03bc837 100644 --- a/src/common/startup_scripts/vnc_startup.sh +++ b/src/common/startup_scripts/vnc_startup.sh @@ -14,6 +14,7 @@ VNC_VIEW_ONLY_PW=$tmpval tmpval=$VNC_PW unset VNC_PW VNC_PW=$tmpval +BUILD_ARCH=$(uname -p) STARTUP_COMPLETE=0 @@ -57,7 +58,11 @@ function start_kasmvnc (){ rm -rf $HOME/.vnc/*.pid - vncserver $DISPLAY -depth $VNC_COL_DEPTH -geometry $VNC_RESOLUTION -websocketPort $NO_VNC_PORT -cert ${HOME}/.vnc/self.pem -httpd ${KASM_VNC_PATH}/www -sslOnly -FrameRate=$MAX_FRAME_RATE -interface 0.0.0.0 $VNCOPTIONS $KASM_SVC_SEND_CUT_TEXT $KASM_SVC_ACCEPT_CUT_TEXT + if [[ "${BUILD_ARCH}" =~ ^aarch64$ ]] && [[ -f /lib/aarch64-linux-gnu/libgcc_s.so.1 ]] ; then + LD_PRELOAD=/lib/aarch64-linux-gnu/libgcc_s.so.1 vncserver $DISPLAY -depth $VNC_COL_DEPTH -geometry $VNC_RESOLUTION -websocketPort $NO_VNC_PORT -cert ${HOME}/.vnc/self.pem -httpd ${KASM_VNC_PATH}/www -sslOnly -FrameRate=$MAX_FRAME_RATE -interface 0.0.0.0 $VNCOPTIONS $KASM_SVC_SEND_CUT_TEXT $KASM_SVC_ACCEPT_CUT_TEXT + else + vncserver $DISPLAY -depth $VNC_COL_DEPTH -geometry $VNC_RESOLUTION -websocketPort $NO_VNC_PORT -cert ${HOME}/.vnc/self.pem -httpd ${KASM_VNC_PATH}/www -sslOnly -FrameRate=$MAX_FRAME_RATE -interface 0.0.0.0 $VNCOPTIONS $KASM_SVC_SEND_CUT_TEXT $KASM_SVC_ACCEPT_CUT_TEXT + fi KASM_PROCS['kasmvnc']=$(cat $HOME/.vnc/*${DISPLAY_NUM}.pid) @@ -162,7 +167,7 @@ trap cleanup SIGINT SIGTERM ## resolve_vnc_connection VNC_IP=$(hostname -i) if [[ $DEBUG == true ]]; then - echo "IP Address used for external bind: $VNC_IP" + echo "IP Address used for external bind: $VNC_IP" fi # Create cert for KasmVNC diff --git a/src/common/xfce/window_manager_startup.sh b/src/common/xfce/window_manager_startup.sh index dddacdd..485c205 100644 --- a/src/common/xfce/window_manager_startup.sh +++ b/src/common/xfce/window_manager_startup.sh @@ -3,15 +3,14 @@ set -e echo -e "\n------------------ Xfce4 window manager startup------------------" -if [ "${START_XFCE4}" == "1" ] ; - then - if [ -f /usr/bin/vglrun ] && [ ! -z "${KASM_EGL_CARD}" ] && [ ! -z "${KASM_RENDERD}" ] && [ -O "${KASM_RENDERD}" ] && [ -O "${KASM_EGL_CARD}" ] ; then - echo "Starting XFCE with VirtualGL" - DISPLAY=:1 /usr/bin/vglrun -d "${KASM_EGL_CARD}" /usr/bin/startxfce4 --replace & - else - echo "Starting XFCE" - /usr/bin/startxfce4 --replace & - fi +if [ "${START_XFCE4}" == "1" ] ; then + if [ -f /opt/VirtualGL/bin/vglrun ] && [ ! -z "${KASM_EGL_CARD}" ] && [ ! -z "${KASM_RENDERD}" ] && [ -O "${KASM_RENDERD}" ] && [ -O "${KASM_EGL_CARD}" ] ; then + echo "Starting XFCE with VirtualGL using EGL device ${KASM_EGL_CARD}" + DISPLAY=:1 /opt/VirtualGL/bin/vglrun -d "${KASM_EGL_CARD}" /usr/bin/startxfce4 --replace & else - echo "Skipping XFCE Startup" + echo "Starting XFCE" + /usr/bin/startxfce4 --replace & fi +else + echo "Skipping XFCE Startup" +fi diff --git a/src/ubuntu/install/virtualgl/VirtualGL-3.0.80-Linux-arm64.tar.bz2 b/src/ubuntu/install/virtualgl/VirtualGL-3.0.80-Linux-arm64.tar.bz2 new file mode 100644 index 0000000..1e4372e Binary files /dev/null and b/src/ubuntu/install/virtualgl/VirtualGL-3.0.80-Linux-arm64.tar.bz2 differ diff --git a/src/ubuntu/install/virtualgl/install_virtualgl.sh b/src/ubuntu/install/virtualgl/install_virtualgl.sh index a5c0f5a..8237469 100644 --- a/src/ubuntu/install/virtualgl/install_virtualgl.sh +++ b/src/ubuntu/install/virtualgl/install_virtualgl.sh @@ -1,13 +1,36 @@ -if [ "$DISTRO" = "ubuntu" ]; then - #update mesa to latest - add-apt-repository ppa:kisak/kisak-mesa - apt full-upgrade -y +BUILD_ARCH=$(uname -p) +if [ "$DISTRO" = "ubuntu" ]; then #install virtualgl #wget https://sourceforge.net/projects/virtualgl/files/2.6.95%20%283.0rc1%29/virtualgl_2.6.95_amd64.deb -P /tmp - set +e - dpkg -i $INST_SCRIPTS/virtualgl/virtualgl_*amd64.deb - set -e + + if [[ "${BUILD_ARCH}" =~ ^aarch64$ ]] ; then + apt-get update && apt-get install -y --no-install-recommends \ + libxau6 libxdmcp6 libxcb1 libxext6 libx11-6 + apt-get update && apt-get install -y --no-install-recommends \ + libglvnd0 libgl1 libglx0 libegl1 libgles2 + + tar -xf $INST_SCRIPTS/virtualgl/VirtualGL-3.0.80-Linux-arm64.tar.bz2 -C / + else + dpkg --add-architecture i386 + apt-get update && apt-get install -y --no-install-recommends \ + libxau6 libxau6:i386 \ + libxdmcp6 libxdmcp6:i386 \ + libxcb1 libxcb1:i386 \ + libxext6 libxext6:i386 \ + libx11-6 libx11-6:i386 + apt-get update && apt-get install -y --no-install-recommends \ + libglvnd0 libglvnd0:i386 \ + libgl1 libgl1:i386 \ + libglx0 libglx0:i386 \ + libegl1 libegl1:i386 \ + libgles2 libgles2:i386 + + add-apt-repository ppa:kisak/kisak-mesa + apt full-upgrade -y + dpkg -i $INST_SCRIPTS/virtualgl/virtualgl_*amd64.deb + fi + apt install -f -y - rm $INST_SCRIPTS/virtualgl/virtualgl_*amd64.deb + rm -rf $INST_SCRIPTS/virtualgl/ fi diff --git a/src/ubuntu/install/virtualgl/virtualgl_3.0.80_arm64.deb b/src/ubuntu/install/virtualgl/virtualgl_3.0.80_arm64.deb new file mode 100644 index 0000000..4935e2d Binary files /dev/null and b/src/ubuntu/install/virtualgl/virtualgl_3.0.80_arm64.deb differ