diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 71b8288..4a46a57 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,6 +6,9 @@ stages: - build - readme +variables: + DOCKER_AUTH_CONFIG: ${_DOCKER_AUTH_CONFIG} + before_script: - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD - export SANITIZED_BRANCH="$(echo $CI_COMMIT_REF_NAME | sed -r 's#^release/##' | sed 's/\//_/g')" @@ -15,16 +18,19 @@ before_script: build_ubuntu_bionic: stage: build script: - - docker build -t ${ORG_NAME}/core-ubuntu-bionic-private:$SANITIZED_BRANCH -t ${ORG_NAME}/core-ubuntu-bionic-private:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/core-ubuntu-bionic:$SANITIZED_BRANCH -t ${ORG_NAME}/core-ubuntu-bionic:$SANITIZED_ROLLING_BRANCH --build-arg BASE_IMAGE="ubuntu:18.04" --build-arg BG_IMG=bg_bionic.png -f dockerfile-kasm-core . - - docker push ${ORG_NAME}/core-ubuntu-bionic-private:$SANITIZED_BRANCH - - docker push ${ORG_NAME}/core-ubuntu-bionic-private:$SANITIZED_ROLLING_BRANCH - - docker push ${ORG_NAME}/core-ubuntu-bionic:$SANITIZED_BRANCH - - docker push ${ORG_NAME}/core-ubuntu-bionic:$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-ubuntu-bionic-private:$SANITIZED_BRANCH -t ${ORG_NAME}/core-ubuntu-bionic-private:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/core-ubuntu-bionic:$SANITIZED_BRANCH -t ${ORG_NAME}/core-ubuntu-bionic:$SANITIZED_ROLLING_BRANCH --build-arg BASE_IMAGE="ubuntu:18.04" --build-arg BG_IMG=bg_bionic.png -f dockerfile-kasm-core . only: - develop - /^release\/.*$/ except: - schedules + tags: + - aws-autoscale build_cuda_bionic: stage: build @@ -87,13 +93,22 @@ build_centos: # These jobs should run on the feature/bugfix branches - anything that is not the develop or release branches. It should only push images to the private repos build_ubuntu_bionic_dev: + image: kasmweb/docker-buildx-private:develop stage: build + variables: + BUILD_PLATFORMS: "linux/amd64,linux/arm64" script: - - docker build -t ${ORG_NAME}/core-ubuntu-bionic-private:$SANITIZED_BRANCH --build-arg BASE_IMAGE="ubuntu:18.04" --build-arg BG_IMG=bg_bionic.png -f dockerfile-kasm-core . - - docker push ${ORG_NAME}/core-ubuntu-bionic-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-ubuntu-bionic-private:$SANITIZED_BRANCH --build-arg BASE_IMAGE="ubuntu:18.04" --build-arg BG_IMG=bg_bionic.png -f dockerfile-kasm-core . except: - develop - /^release\/.*$/ + tags: + - aws-autoscale build_cuda_bionic_dev: @@ -138,11 +153,16 @@ build_centos_dev: build_ubuntu_bionic_scheduled: stage: build script: - - docker build -t ${ORG_NAME}/core-ubuntu-bionic-private:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/core-ubuntu-bionic:$SANITIZED_ROLLING_BRANCH --build-arg BASE_IMAGE="ubuntu:18.04" --build-arg BG_IMG=bg_bionic.png -f dockerfile-kasm-core . - - docker push ${ORG_NAME}/core-ubuntu-bionic-private:$SANITIZED_ROLLING_BRANCH - - docker push ${ORG_NAME}/core-ubuntu-bionic:$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-ubuntu-bionic-private:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/core-ubuntu-bionic:$SANITIZED_ROLLING_BRANCH --build-arg BASE_IMAGE="ubuntu:18.04" --build-arg BG_IMG=bg_bionic.png -f dockerfile-kasm-core . only: - schedules + tags: + - aws-autoscale build_cuda_bionic_schedules: stage: build diff --git a/dockerfile-kasm-core b/dockerfile-kasm-core index 89ff52e..68f39a0 100644 --- a/dockerfile-kasm-core +++ b/dockerfile-kasm-core @@ -2,22 +2,13 @@ ARG BASE_IMAGE="ubuntu:18.04" FROM $BASE_IMAGE AS install_tools ARG DISTRO=ubuntu -### Install common tools - -COPY ./src/ubuntu/install/tools $INST_SCRIPTS/tools/ -RUN bash $INST_SCRIPTS/tools/install_tools.sh && rm -rf $INST_SCRIPTS/tools/ - -FROM install_tools AS squid_builder - -### Build Squid -RUN wget 'https://kasmweb-build-artifacts.s3.amazonaws.com/kasm-squid-builder/a590f319f328a8a576cb966c2db5ec4a5b3b7b9b/output/kasm-squid-builder_ubuntu.tar.gz' -RUN tar -xzf kasm-squid-builder_ubuntu.tar.gz -C / - -FROM install_tools - MAINTAINER 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 @@ -102,9 +93,6 @@ RUN bash $INST_SCRIPTS/audio_input/install_audio_input.sh && rm -rf $INST_SCRIPT COPY ./src/ubuntu/install/cursors $INST_SCRIPTS/cursors/ RUN bash $INST_SCRIPTS/cursors/install_cursors.sh && rm -rf $INST_SCRIPTS/cursors/ -### Copy built Squid -COPY --from=squid_builder /usr/local/squid /usr/local/squid - ### Install Squid COPY ./src/ubuntu/install/squid/install/ $INST_SCRIPTS/squid_install/ RUN bash $INST_SCRIPTS/squid_install/install_squid.sh && rm -rf $INST_SCRIPTS/squid_install/ diff --git a/src/ubuntu/install/kasm_vnc/install_kasm_vnc.sh b/src/ubuntu/install/kasm_vnc/install_kasm_vnc.sh index eb391c2..a999b29 100644 --- a/src/ubuntu/install/kasm_vnc/install_kasm_vnc.sh +++ b/src/ubuntu/install/kasm_vnc/install_kasm_vnc.sh @@ -11,13 +11,20 @@ install_libjpeg_turbo() { echo "Install KasmVNC server" cd /tmp + +BUILD_ARCH=$(uname -p) + if [ "${DISTRO}" == "kali" ] ; then BUILD_URL="https://kasmweb-build-artifacts.s3.amazonaws.com/kasmvnc/a9434a300dbf85e65d0e9c212610a487fd10a308/kasmvncserver_kali-rolling_0.9.3_master_a9434a_amd64.deb" elif [ "${DISTRO}" == "centos" ] ; then BUILD_URL="https://kasmweb-build-artifacts.s3.amazonaws.com/kasmvnc/a9434a300dbf85e65d0e9c212610a487fd10a308/output/centos_core/kasmvncserver-0.9.1~beta-1.el7.x86_64.rpm" else - BUILD_URL="https://kasmweb-build-artifacts.s3.amazonaws.com/kasmvnc/a9434a300dbf85e65d0e9c212610a487fd10a308/kasmvncserver_bionic_0.9.3_master_a9434a_libjpeg-turbo-latest_amd64.deb" + if [[ "${BUILD_ARCH}" =~ ^aarch64$ ]] ; then + BUILD_URL="https://kasmweb-build-artifacts.s3.amazonaws.com/kasmvnc/a9434a300dbf85e65d0e9c212610a487fd10a308/kasmvncserver_bionic_0.9.3_master_a9434a_arm64.deb" + else + BUILD_URL="https://kasmweb-build-artifacts.s3.amazonaws.com/kasmvnc/a9434a300dbf85e65d0e9c212610a487fd10a308/kasmvncserver_bionic_0.9.3_master_a9434a_libjpeg-turbo-latest_amd64.deb" + fi fi @@ -27,7 +34,7 @@ if [ "${DISTRO}" == "centos" ] ; then yum localinstall -y kasmvncserver.rpm rm kasmvncserver.rpm else - if [ "$DISTRO" = "ubuntu" ]; then + if [[ "$DISTRO" = "ubuntu" ]] && [[ ! "$BUILD_ARCH" =~ ^aarch64$ ]] ; then install_libjpeg_turbo fi diff --git a/src/ubuntu/install/squid/install/install_squid.sh b/src/ubuntu/install/squid/install/install_squid.sh index e98a807..1c95ee3 100644 --- a/src/ubuntu/install/squid/install/install_squid.sh +++ b/src/ubuntu/install/squid/install/install_squid.sh @@ -1,8 +1,18 @@ -# update squid conf with user info +#!/bin/bash set -ex ARCH=$(arch | sed 's/aarch64/arm64/g' | sed 's/x86_64/amd64/g') +# intall squid +SQUID_COMMIT='6392f7dfb1040c67c0a5d5518abf508282523cc0' +SQUID_DISTRO=${DISTRO} +# currently all distros use the ubuntu build of squid except centos +if [ ! "${SQUID_DISTRO}" == "centos" ] ; then + SQUID_DISTRO="ubuntu" +fi +wget -qO- "https://kasmweb-build-artifacts.s3.amazonaws.com/kasm-squid-builder/${SQUID_COMMIT}/output/kasm-squid-builder_${SQUID_DISTRO}_${ARCH}.tar.gz" | tar -xzf - -C / + +# update squid conf with user info if [ "$DISTRO" = centos ]; then useradd --system --shell /usr/sbin/nologin --home-dir /bin proxy fi