KASM-2193 Removed the use of the private arg to docker files

Also fixed up the if condition logic for private variable in gitlab-ci
This commit is contained in:
Richard Koliser 2022-03-23 17:11:48 -04:00
parent cd129cd194
commit ed08d9749a
6 changed files with 39 additions and 28 deletions

View File

@ -34,7 +34,7 @@ build_browser_images:
- ls docs/$KASM_IMAGE/README.md - ls docs/$KASM_IMAGE/README.md
- ls docs/$KASM_IMAGE/description.txt - ls docs/$KASM_IMAGE/description.txt
# Check for private variable to build against private core images # Check for private variable to build against private core images
- if [[ $USE_PRIVATE_IMAGES ]]; then CORE_IMAGE=$CORE_IMAGE-private; fi; - if [[ $USE_PRIVATE_IMAGES -eq 1 ]]; then CORE_IMAGE=$CORE_IMAGE-private; fi;
- docker buildx build --push --platform $BUILD_PLATFORM -t ${ORG_NAME}/$KASM_IMAGE:$SANITIZED_BRANCH -t ${ORG_NAME}/$KASM_IMAGE:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_BRANCH -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_ROLLING_BRANCH --build-arg BASE_IMAGE=$CORE_IMAGE --build-arg BASE_TAG=$CORE_IMAGE_TAG -f dockerfile-kasm-$KASM_IMAGE . - docker buildx build --push --platform $BUILD_PLATFORM -t ${ORG_NAME}/$KASM_IMAGE:$SANITIZED_BRANCH -t ${ORG_NAME}/$KASM_IMAGE:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_BRANCH -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_ROLLING_BRANCH --build-arg BASE_IMAGE=$CORE_IMAGE --build-arg BASE_TAG=$CORE_IMAGE_TAG -f dockerfile-kasm-$KASM_IMAGE .
only: only:
@ -63,7 +63,7 @@ build_app_images:
- ls docs/$KASM_IMAGE/README.md - ls docs/$KASM_IMAGE/README.md
- ls docs/$KASM_IMAGE/description.txt - ls docs/$KASM_IMAGE/description.txt
# Check for private variable to build against private core images # Check for private variable to build against private core images
- if [[ $USE_PRIVATE_IMAGES ]]; then CORE_IMAGE=$CORE_IMAGE-private; fi; - if [[ $USE_PRIVATE_IMAGES -eq 1 ]]; then CORE_IMAGE=$CORE_IMAGE-private; fi;
- docker buildx build --push --platform $BUILD_PLATFORM -t ${ORG_NAME}/$KASM_IMAGE:$SANITIZED_BRANCH -t ${ORG_NAME}/$KASM_IMAGE:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_BRANCH -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_ROLLING_BRANCH --build-arg BASE_IMAGE=$CORE_IMAGE --build-arg BASE_TAG=$CORE_IMAGE_TAG -f dockerfile-kasm-$KASM_IMAGE . - docker buildx build --push --platform $BUILD_PLATFORM -t ${ORG_NAME}/$KASM_IMAGE:$SANITIZED_BRANCH -t ${ORG_NAME}/$KASM_IMAGE:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_BRANCH -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_ROLLING_BRANCH --build-arg BASE_IMAGE=$CORE_IMAGE --build-arg BASE_TAG=$CORE_IMAGE_TAG -f dockerfile-kasm-$KASM_IMAGE .
only: only:
@ -92,9 +92,9 @@ build_ubuntu_desktop_images:
- ls docs/$KASM_IMAGE/README.md - ls docs/$KASM_IMAGE/README.md
- ls docs/$KASM_IMAGE/description.txt - ls docs/$KASM_IMAGE/description.txt
# Check for private variable to build against private core images # Check for private variable to build against private core images
- if [[ $USE_PRIVATE_IMAGES ]]; then PRIVATE=-private; CORE_IMAGE=$CORE_IMAGE-private; else PRIVATE=""; fi; - if [[ $USE_PRIVATE_IMAGES -eq 1 ]]; then CORE_IMAGE=$CORE_IMAGE-private; fi;
- docker buildx build --push --platform $BUILD_PLATFORM -t ${ORG_NAME}/$KASM_IMAGE:$SANITIZED_BRANCH -t ${ORG_NAME}/$KASM_IMAGE:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_BRANCH -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_ROLLING_BRANCH --build-arg BASE_IMAGE=$CORE_IMAGE --build-arg PRIVATE=$PRIVATE --build-arg BASE_TAG=$CORE_IMAGE_TAG -f dockerfile-kasm-$KASM_IMAGE . - docker buildx build --push --platform $BUILD_PLATFORM -t ${ORG_NAME}/$KASM_IMAGE:$SANITIZED_BRANCH -t ${ORG_NAME}/$KASM_IMAGE:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_BRANCH -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_ROLLING_BRANCH --build-arg BASE_IMAGE=$CORE_IMAGE --build-arg BASE_TAG=$CORE_IMAGE_TAG -f dockerfile-kasm-$KASM_IMAGE .
only: only:
- develop - develop
- /^release\/.*$/ - /^release\/.*$/
@ -120,10 +120,13 @@ build_non_ubuntu:
# Ensure readme and description files are present # Ensure readme and description files are present
- ls docs/$KASM_IMAGE/README.md - ls docs/$KASM_IMAGE/README.md
- ls docs/$KASM_IMAGE/description.txt - ls docs/$KASM_IMAGE/description.txt
# Set base image based on kasm_image variable
- if [[ $KASM_IMAGE =~ 'centos-7-desktop' ]]; then CORE_IMAGE=core-centos-7; fi
- if [[ $KASM_IMAGE =~ 'tracelabs' ]]; then CORE_IMAGE=core-kali-rolling; fi
# Check for private variable to build against private core images # Check for private variable to build against private core images
- if [[ $USE_PRIVATE_IMAGES ]]; then PRIVATE=-private; else PRIVATE=""; fi; - if [[ $USE_PRIVATE_IMAGES -eq 1 ]]; then CORE_IMAGE=$CORE_IMAGE-private; fi;
- docker buildx build --push --platform $BUILD_PLATFORM -t ${ORG_NAME}/$KASM_IMAGE:$SANITIZED_BRANCH -t ${ORG_NAME}/$KASM_IMAGE:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_BRANCH -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_ROLLING_BRANCH --build-arg PRIVATE=$PRIVATE --build-arg BASE_TAG=$CORE_IMAGE_TAG -f dockerfile-kasm-$KASM_IMAGE . - docker buildx build --push --platform $BUILD_PLATFORM -t ${ORG_NAME}/$KASM_IMAGE:$SANITIZED_BRANCH -t ${ORG_NAME}/$KASM_IMAGE:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_BRANCH -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_ROLLING_BRANCH --build-arg BASE_IMAGE=$CORE_IMAGE --build-arg BASE_TAG=$CORE_IMAGE_TAG -f dockerfile-kasm-$KASM_IMAGE .
only: only:
- develop - develop
- /^release\/.*$/ - /^release\/.*$/
@ -154,7 +157,7 @@ build_dev_browser_images:
- ls docs/$KASM_IMAGE/README.md - ls docs/$KASM_IMAGE/README.md
- ls docs/$KASM_IMAGE/description.txt - ls docs/$KASM_IMAGE/description.txt
# Check for private variable to build against private core images # Check for private variable to build against private core images
- if [[ $USE_PRIVATE_IMAGES ]]; then CORE_IMAGE=$CORE_IMAGE-private; fi; - if [[ $USE_PRIVATE_IMAGES -eq 1 ]]; then CORE_IMAGE=$CORE_IMAGE-private; fi;
# Equivalent to docker build and docker push. Builds amd64 natively uses qemu for arm64. # Equivalent to docker build and docker push. Builds amd64 natively uses qemu for arm64.
# The only way to push multiple architectures to the same tag is to use buildx. # The only way to push multiple architectures to the same tag is to use buildx.
@ -183,7 +186,7 @@ build_dev_app_images:
- ls docs/$KASM_IMAGE/README.md - ls docs/$KASM_IMAGE/README.md
- ls docs/$KASM_IMAGE/description.txt - ls docs/$KASM_IMAGE/description.txt
# Check for private variable to build against private core images # Check for private variable to build against private core images
- if [[ $USE_PRIVATE_IMAGES ]]; then CORE_IMAGE=$CORE_IMAGE-private; fi; - if [[ $USE_PRIVATE_IMAGES -eq 1 ]]; then CORE_IMAGE=$CORE_IMAGE-private; fi;
# Equivalent to docker build and docker push. Builds amd64 natively uses qemu for arm64. # Equivalent to docker build and docker push. Builds amd64 natively uses qemu for arm64.
# The only way to push multiple architectures to the same tag is to use buildx. # The only way to push multiple architectures to the same tag is to use buildx.
@ -212,11 +215,11 @@ build_dev_ubuntu_desktop_images:
- ls docs/$KASM_IMAGE/README.md - ls docs/$KASM_IMAGE/README.md
- ls docs/$KASM_IMAGE/description.txt - ls docs/$KASM_IMAGE/description.txt
# Check for private variable to build against private core images # Check for private variable to build against private core images
- if [[ $USE_PRIVATE_IMAGES ]]; then PRIVATE=-private; CORE_IMAGE=$CORE_IMAGE-private; else PRIVATE=""; fi; - if [[ $USE_PRIVATE_IMAGES -eq 1 ]]; then CORE_IMAGE=$CORE_IMAGE-private; fi;
# Equivalent to docker build and docker push. Builds amd64 natively uses qemu for arm64. # Equivalent to docker build and docker push. Builds amd64 natively uses qemu for arm64.
# The only way to push multiple architectures to the same tag is to use buildx. # The only way to push multiple architectures to the same tag is to use buildx.
- docker buildx build --push --platform $BUILD_PLATFORM -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_BRANCH --build-arg PRIVATE=$PRIVATE --build-arg BASE_IMAGE=$CORE_IMAGE --build-arg BASE_TAG=$CORE_IMAGE_TAG -f dockerfile-kasm-$KASM_IMAGE . - docker buildx build --push --platform $BUILD_PLATFORM -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_BRANCH --build-arg BASE_IMAGE=$CORE_IMAGE --build-arg BASE_TAG=$CORE_IMAGE_TAG -f dockerfile-kasm-$KASM_IMAGE .
except: except:
- develop - develop
- /^release\/.*$/ - /^release\/.*$/
@ -240,11 +243,15 @@ build_dev_non_ubuntu:
# Ensure readme and description files are present # Ensure readme and description files are present
- ls docs/$KASM_IMAGE/README.md - ls docs/$KASM_IMAGE/README.md
- ls docs/$KASM_IMAGE/description.txt - ls docs/$KASM_IMAGE/description.txt
- if [[ $USE_PRIVATE_IMAGES ]]; then PRIVATE=-private; else PRIVATE=""; fi; # Set base image based on kasm_image variable
- if [[ $KASM_IMAGE =~ 'centos-7-desktop' ]]; then CORE_IMAGE=core-centos-7; fi
- if [[ $KASM_IMAGE =~ 'tracelabs' ]]; then CORE_IMAGE=core-kali-rolling; fi
# Check for private variable to build against private core images
- if [[ $USE_PRIVATE_IMAGES -eq 1 ]]; then CORE_IMAGE=$CORE_IMAGE-private; fi;
# Equivalent to docker build and docker push. Builds amd64 natively uses qemu for arm64. # Equivalent to docker build and docker push. Builds amd64 natively uses qemu for arm64.
# The only way to push multiple architectures to the same tag is to use buildx. # The only way to push multiple architectures to the same tag is to use buildx.
- docker buildx build --push --platform $BUILD_PLATFORM -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_BRANCH --build-arg PRIVATE=$PRIVATE --build-arg BASE_TAG=$CORE_IMAGE_TAG -f dockerfile-kasm-$KASM_IMAGE . - docker buildx build --push --platform $BUILD_PLATFORM -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_BRANCH --build-arg BASE_IMAGE=$CORE_IMAGE --build-arg BASE_TAG=$CORE_IMAGE_TAG -f dockerfile-kasm-$KASM_IMAGE .
except: except:
- develop - develop
- /^release\/.*$/ - /^release\/.*$/
@ -271,7 +278,7 @@ build_schedules_browser_images:
- ls docs/$KASM_IMAGE/README.md - ls docs/$KASM_IMAGE/README.md
- ls docs/$KASM_IMAGE/description.txt - ls docs/$KASM_IMAGE/description.txt
# Check for private variable to build against private core images # Check for private variable to build against private core images
- if [[ $USE_PRIVATE_IMAGES ]]; then CORE_IMAGE=$CORE_IMAGE-private; fi; - if [[ $USE_PRIVATE_IMAGES -eq 1 ]]; then CORE_IMAGE=$CORE_IMAGE-private; fi;
# Equivalent to docker build and docker push. Builds amd64 natively uses qemu for arm64. # Equivalent to docker build and docker push. Builds amd64 natively uses qemu for arm64.
# The only way to push multiple architectures to the same tag is to use buildx. # The only way to push multiple architectures to the same tag is to use buildx.
@ -300,7 +307,7 @@ build_schedules_app_images:
- ls docs/$KASM_IMAGE/README.md - ls docs/$KASM_IMAGE/README.md
- ls docs/$KASM_IMAGE/description.txt - ls docs/$KASM_IMAGE/description.txt
# Check for private variable to build against private core images # Check for private variable to build against private core images
- if [[ $USE_PRIVATE_IMAGES ]]; then CORE_IMAGE=$CORE_IMAGE-private; fi; - if [[ $USE_PRIVATE_IMAGES -eq 1 ]]; then CORE_IMAGE=$CORE_IMAGE-private; fi;
# Equivalent to docker build and docker push. Builds amd64 natively uses qemu for arm64. # Equivalent to docker build and docker push. Builds amd64 natively uses qemu for arm64.
# The only way to push multiple architectures to the same tag is to use buildx. # The only way to push multiple architectures to the same tag is to use buildx.
@ -329,11 +336,11 @@ build_schedules_ubuntu_desktop_images:
- ls docs/$KASM_IMAGE/README.md - ls docs/$KASM_IMAGE/README.md
- ls docs/$KASM_IMAGE/description.txt - ls docs/$KASM_IMAGE/description.txt
# Check for private variable to build against private core images # Check for private variable to build against private core images
- if [[ $USE_PRIVATE_IMAGES ]]; then PRIVATE=-private; CORE_IMAGE=$CORE_IMAGE-private; else PRIVATE=""; fi; - if [[ $USE_PRIVATE_IMAGES -eq 1 ]]; then CORE_IMAGE=$CORE_IMAGE-private; fi;
# Equivalent to docker build and docker push. Builds amd64 natively uses qemu for arm64. # Equivalent to docker build and docker push. Builds amd64 natively uses qemu for arm64.
# The only way to push multiple architectures to the same tag is to use buildx. # The only way to push multiple architectures to the same tag is to use buildx.
- docker buildx build --push --platform $BUILD_PLATFORM -t ${ORG_NAME}/$KASM_IMAGE:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_ROLLING_BRANCH --build-arg BASE_IMAGE=$CORE_IMAGE --build-arg PRIVATE=$PRIVATE --build-arg BASE_TAG="$SANITIZED_ROLLING_BRANCH" -f dockerfile-kasm-$KASM_IMAGE . - docker buildx build --push --platform $BUILD_PLATFORM -t ${ORG_NAME}/$KASM_IMAGE:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_ROLLING_BRANCH --build-arg BASE_IMAGE=$CORE_IMAGE --build-arg BASE_TAG="$SANITIZED_ROLLING_BRANCH" -f dockerfile-kasm-$KASM_IMAGE .
only: only:
- schedules - schedules
tags: tags:
@ -356,11 +363,15 @@ build_schedules_non_ubuntu:
# Ensure readme and description files are present # Ensure readme and description files are present
- ls docs/$KASM_IMAGE/README.md - ls docs/$KASM_IMAGE/README.md
- ls docs/$KASM_IMAGE/description.txt - ls docs/$KASM_IMAGE/description.txt
- if [[ $USE_PRIVATE_IMAGES ]]; then PRIVATE=-private; else PRIVATE=""; fi; # Set base image based on kasm_image variable
- if [[ $KASM_IMAGE =~ 'centos-7-desktop' ]]; then CORE_IMAGE=core-centos-7; fi
- if [[ $KASM_IMAGE =~ 'tracelabs' ]]; then CORE_IMAGE=core-kali-rolling; fi
# Check for private variable to build against private core images
- if [[ $USE_PRIVATE_IMAGES -eq 1 ]]; then CORE_IMAGE=$CORE_IMAGE-private; fi;
# Equivalent to docker build and docker push. Builds amd64 natively uses qemu for arm64. # Equivalent to docker build and docker push. Builds amd64 natively uses qemu for arm64.
# The only way to push multiple architectures to the same tag is to use buildx. # The only way to push multiple architectures to the same tag is to use buildx.
- docker buildx build --push --platform $BUILD_PLATFORM -t ${ORG_NAME}/$KASM_IMAGE:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_ROLLING_BRANCH --build-arg PRIVATE=$PRIVATE --build-arg BASE_TAG="$SANITIZED_ROLLING_BRANCH" -f dockerfile-kasm-$KASM_IMAGE . - docker buildx build --push --platform $BUILD_PLATFORM -t ${ORG_NAME}/$KASM_IMAGE:$SANITIZED_ROLLING_BRANCH -t ${ORG_NAME}/$KASM_IMAGE-private:$SANITIZED_ROLLING_BRANCH --build-arg BASE_IMAGE=$CORE_IMAGE --build-arg BASE_TAG="$SANITIZED_ROLLING_BRANCH" -f dockerfile-kasm-$KASM_IMAGE .
only: only:
- schedules - schedules
tags: tags:

View File

@ -1,6 +1,6 @@
ARG BASE_TAG="develop" ARG BASE_TAG="develop"
ARG PRIVATE="" ARG BASE_IMAGE="core-centos-7"
FROM kasmweb/core-centos-7$PRIVATE:$BASE_TAG FROM kasmweb/$BASE_IMAGE:$BASE_TAG
USER root USER root
ENV DISTRO=centos ENV DISTRO=centos

View File

@ -1,6 +1,6 @@
ARG BASE_TAG="develop" ARG BASE_TAG="develop"
ARG PRIVATE="" ARG BASE_IMAGE="core-kali-rolling"
FROM kasmweb/core-kali-rolling$PRIVATE:$BASE_TAG FROM kasmweb/$BASE_IMAGE:$BASE_TAG
USER root USER root
ENV HOME /home/kasm-default-profile ENV HOME /home/kasm-default-profile

View File

@ -1,6 +1,6 @@
ARG BASE_TAG="develop" ARG BASE_TAG="develop"
ARG PRIVATE="" ARG BASE_IMAGE="core-ubuntu-focal"
FROM kasmweb/core-ubuntu-focal$PRIVATE:$BASE_TAG FROM kasmweb/$BASE_IMAGE:$BASE_TAG
USER root USER root

View File

@ -1,6 +1,6 @@
ARG BASE_TAG="develop" ARG BASE_TAG="develop"
ARG PRIVATE="" ARG BASE_IMAGE="core-ubuntu-focal"
FROM kasmweb/core-ubuntu-focal$PRIVATE:$BASE_TAG FROM kasmweb/$BASE_IMAGE:$BASE_TAG
USER root USER root
ENV HOME /home/kasm-default-profile ENV HOME /home/kasm-default-profile

View File

@ -1,6 +1,6 @@
ARG BASE_TAG="develop" ARG BASE_TAG="develop"
ARG PRIVATE="" ARG BASE_IMAGE="core-ubuntu-focal"
FROM kasmweb/core-ubuntu-focal$PRIVATE:$BASE_TAG FROM kasmweb/$BASE_IMAGE:$BASE_TAG
USER root USER root
ENV HOME /home/kasm-default-profile ENV HOME /home/kasm-default-profile