Resolve KASM-6027 "Feature/ alpine 320"

This commit is contained in:
Ryan Kuba 2024-06-06 15:32:29 +00:00 committed by Richard Koliser
parent 7fc3797294
commit a781d87b81
12 changed files with 152 additions and 79 deletions

View File

@ -385,6 +385,15 @@ multiImages:
- src/ubuntu/install/langpacks/**
- src/ubuntu/install/cleanup/**
- src/alpine/install/**
- name: alpine-320-desktop
singleapp: false
base: core-alpine-320
dockerfile: dockerfile-kasm-alpine-320-desktop
changeFiles:
- dockerfile-kasm-alpine-320-desktop
- src/ubuntu/install/langpacks/**
- src/ubuntu/install/cleanup/**
- src/alpine/install/**
- name: brave
singleapp: true
base: core-ubuntu-focal
@ -650,13 +659,6 @@ multiImages:
- src/ubuntu/install/certificates/**
- src/ubuntu/install/vivaldi/**
singleImages:
- name: atom
singleapp: true
base: core-ubuntu-focal
dockerfile: dockerfile-kasm-atom
changeFiles:
- dockerfile-kasm-atom
- src/ubuntu/install/atom/**
- name: blender
singleapp: true
base: core-ubuntu-focal

View File

@ -0,0 +1,54 @@
ARG BASE_TAG="develop"
ARG BASE_IMAGE="core-alpine-320"
FROM kasmweb/$BASE_IMAGE:$BASE_TAG
USER root
ENV DISTRO=alpine320
ENV HOME /home/kasm-default-profile
ENV STARTUPDIR /dockerstartup
WORKDIR $HOME
### Envrionment config
ENV SKIP_CLEAN=true \
INST_DIR=$STARTUPDIR/install \
INST_SCRIPTS="/alpine/install/tools/install_tools_deluxe.sh \
/alpine/install/misc/install_tools.sh \
/alpine/install/firefox/install_firefox.sh \
/alpine/install/remmina/install_remmina.sh \
/alpine/install/gimp/install_gimp.sh \
/alpine/install/ansible/install_ansible.sh \
/alpine/install/terraform/install_terraform.sh \
/alpine/install/thunderbird/install_thunderbird.sh \
/alpine/install/audacity/install_audacity.sh \
/alpine/install/blender/install_blender.sh \
/alpine/install/geany/install_geany.sh \
/alpine/install/inkscape/install_inkscape.sh \
/alpine/install/libre_office/install_libre_office.sh \
/alpine/install/pinta/install_pinta.sh \
/alpine/install/obs/install_obs.sh \
/alpine/install/filezilla/install_filezilla.sh \
/ubuntu/install/langpacks/install_langpacks.sh \
/ubuntu/install/cleanup/cleanup.sh"
# Copy install scripts
COPY ./src/ $INST_DIR
# Run installations
RUN \
for SCRIPT in $INST_SCRIPTS; do \
bash ${INST_DIR}${SCRIPT} || exit 1; \
done && \
$STARTUPDIR/set_user_permission.sh $HOME && \
rm -f /etc/X11/xinit/Xclients && \
chown 1000:0 $HOME && \
mkdir -p /home/kasm-user && \
chown -R 1000:0 /home/kasm-user && \
rm -Rf ${INST_DIR}
# Userspace Runtime
ENV HOME /home/kasm-user
WORKDIR $HOME
USER 1000
CMD ["--tail-log"]

View File

@ -9,25 +9,16 @@ ENV INST_SCRIPTS $STARTUPDIR/install
WORKDIR $HOME
# Rootless Dind
ENV DOCKER_BIN=/usr/local/lib/docker \
XDG_RUNTIME_DIR=/docker
RUN mkdir -p $DOCKER_BIN && chown 1000:0 $DOCKER_BIN && \
mkdir -p $XDG_RUNTIME_DIR && chown 1000:0 $XDG_RUNTIME_DIR
ENV PATH=$DOCKER_BIN:$DOCKER_BIN/cli-plugins:$PATH \
DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock
COPY ./src/ubuntu/install/dind_rootless/install_dind_rootless_prerequisites.sh $INST_SCRIPTS/dind_rootless/
RUN bash $INST_SCRIPTS/dind_rootless/install_dind_rootless_prerequisites.sh
COPY ./src/ubuntu/install/dind_rootless/install_dind_rootless.sh $INST_SCRIPTS/dind_rootless/
RUN chown 1000:1000 $INST_SCRIPTS/dind_rootless/install_dind_rootless.sh
# It's recommended that docker-rootless be installed by non root user
USER 1000
RUN bash $INST_SCRIPTS/dind_rootless/install_dind_rootless.sh
USER root
RUN rm -rf $INST_SCRIPTS/dind_rootless
COPY ./src/ubuntu/install/dind_rootless/custom_startup.sh $STARTUPDIR/custom_startup.sh
RUN chmod +x $STARTUPDIR/custom_startup.sh && chmod 755 $STARTUPDIR/custom_startup.sh
COPY ./src/ubuntu/install/dind_rootless/modprobe /usr/local/bin/modprobe
RUN chmod +x /usr/local/bin/modprobe
ENV XDG_RUNTIME_DIR=/docker \
DOCKER_HOST=unix:///docker/docker.sock
RUN mkdir -p $XDG_RUNTIME_DIR && chown 1000:0 $XDG_RUNTIME_DIR
### Envrionment config
ENV DEBIAN_FRONTEND=noninteractive \

View File

@ -9,25 +9,16 @@ ENV INST_SCRIPTS $STARTUPDIR/install
WORKDIR $HOME
# Rootless Dind
ENV DOCKER_BIN=/usr/local/lib/docker \
XDG_RUNTIME_DIR=/docker
RUN mkdir -p $DOCKER_BIN && chown 1000:0 $DOCKER_BIN && \
mkdir -p $XDG_RUNTIME_DIR && chown 1000:0 $XDG_RUNTIME_DIR
ENV PATH=$DOCKER_BIN:$DOCKER_BIN/cli-plugins:$PATH \
DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock
COPY ./src/ubuntu/install/dind_rootless/install_dind_rootless_prerequisites.sh $INST_SCRIPTS/dind_rootless/
RUN bash $INST_SCRIPTS/dind_rootless/install_dind_rootless_prerequisites.sh
COPY ./src/ubuntu/install/dind_rootless/install_dind_rootless.sh $INST_SCRIPTS/dind_rootless/
RUN chown 1000:1000 $INST_SCRIPTS/dind_rootless/install_dind_rootless.sh
# It's recommended that docker-rootless be installed by non root user
USER 1000
RUN bash $INST_SCRIPTS/dind_rootless/install_dind_rootless.sh
USER root
RUN rm -rf $INST_SCRIPTS/dind_rootless
COPY ./src/ubuntu/install/dind_rootless/custom_startup.sh $STARTUPDIR/custom_startup.sh
RUN chmod +x $STARTUPDIR/custom_startup.sh && chmod 755 $STARTUPDIR/custom_startup.sh
COPY ./src/ubuntu/install/dind_rootless/modprobe /usr/local/bin/modprobe
RUN chmod +x /usr/local/bin/modprobe
ENV XDG_RUNTIME_DIR=/docker \
DOCKER_HOST=unix:///docker/docker.sock
RUN mkdir -p $XDG_RUNTIME_DIR && chown 1000:0 $XDG_RUNTIME_DIR
### Envrionment config
ENV DEBIAN_FRONTEND=noninteractive \

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -ex
if grep -q v3.19 /etc/os-release; then
if grep -q v3.19 /etc/os-release || grep -q v3.20 /etc/os-release; then
apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ \
opentofu
else

View File

@ -7,9 +7,9 @@ CHROME_ARGS="--password-store=basic --no-sandbox --ignore-gpu-blocklist --user-d
apt-get update
apt install -y apt-transport-https curl
curl -s https://brave-browser-apt-release.s3.brave.com/brave-core.asc | apt-key --keyring /etc/apt/trusted.gpg.d/brave-browser-release.gpg add -
curl -fsSLo /usr/share/keyrings/brave-browser-archive-keyring.gpg https://brave-browser-apt-release.s3.brave.com/brave-browser-archive-keyring.gpg
echo "deb [arch=${ARCH}] https://brave-browser-apt-release.s3.brave.com/ stable main" | tee /etc/apt/sources.list.d/brave-browser-release.list
echo "deb [signed-by=/usr/share/keyrings/brave-browser-archive-keyring.gpg] https://brave-browser-apt-release.s3.brave.com/ stable main"| tee /etc/apt/sources.list.d/brave-browser-release.list
apt update

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -ex
START_COMMAND="$DOCKER_BIN/dockerd-rootless.sh"
START_COMMAND="dockerd-rootless.sh"
PGREP="dockerd"
export MAXIMIZE="false"
MAXIMIZE_SCRIPT=$STARTUPDIR/maximize_window.sh

View File

@ -1,21 +1,60 @@
#!/usr/bin/env bash
set -ex
# This script should be executed as a non-root user.
# User verification: deny running as root
if [ "$(id -u)" = "0" ]; then
>&2 echo "Refusing to install rootless Docker as the root user"; exit 1
# Enable Docker repo
ARCH=$(arch | sed 's/aarch64/arm64/g' | sed 's/x86_64/amd64/g')
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
echo "deb [arch=${ARCH}] https://download.docker.com/linux/ubuntu "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" > \
/etc/apt/sources.list.d/docker.list
# Install deps
apt-get update
apt-get install -y \
ca-certificates \
curl \
dbus-user-session \
docker-buildx-plugin \
docker-ce \
docker-ce-cli \
docker-compose-plugin \
fuse-overlayfs \
iptables \
kmod \
openssh-client \
sudo \
supervisor \
uidmap \
wget
# URLs
STABLE_LATEST=$(curl -sL https://get.docker.com/rootless | awk -F'="' '/STABLE_LATEST=/ {print substr($2, 1, length($2)-1)}')
STATIC_RELEASE_ROOTLESS_URL="https://download.docker.com/linux/static/stable/$(uname -m)/docker-rootless-extras-${STABLE_LATEST}.tgz"
# User settings
curl -o \
/usr/local/bin/dind -L \
https://raw.githubusercontent.com/moby/moby/master/hack/dind
chmod +x /usr/local/bin/dind
echo 'hosts: files dns' > /etc/nsswitch.conf
# Install rootless extras
curl -o \
/tmp/rootless.tgz -L \
"${STATIC_RELEASE_ROOTLESS_URL}"
tar -xf \
/tmp/rootless.tgz \
--strip-components 1 \
--directory /usr/local/bin/ \
'docker-rootless-extras/dockerd-rootless.sh' \
'docker-rootless-extras/rootlesskit' \
'docker-rootless-extras/rootlesskit-docker-proxy' \
'docker-rootless-extras/vpnkit'
# Cleanup
if [ -z ${SKIP_CLEAN+x} ]; then
apt-get autoclean
rm -rf \
/var/lib/apt/lists/* \
/var/tmp/* \
/tmp/*
fi
echo "Installing Docker"
curl -fsSL https://get.docker.com/rootless | sh
dockerd --version
docker --version
echo "Installing Docker Compose"
mkdir -p "${DOCKER_BIN}"/cli-plugins
COMPOSE_RELEASE=$(curl -sX GET "https://api.github.com/repos/docker/compose/releases/latest" \
| awk '/tag_name/{print $4;exit}' FS='[""]');
COMPOSE_OS=$(uname -s)
curl -L https://github.com/docker/compose/releases/download/"${COMPOSE_RELEASE}"/docker-compose-"${COMPOSE_OS,,}"-"$(uname -m)" -o "${DOCKER_BIN}"/cli-plugins/docker-compose
chmod +x "${DOCKER_BIN}"/cli-plugins/docker-compose

View File

@ -1,21 +0,0 @@
#!/usr/bin/env bash
set -ex
apt-get update && apt-get install -y \
ca-certificates \
curl \
dbus-user-session \
fuse-overlayfs \
kmod \
iptables \
openssh-client \
uidmap \
wget \
slirp4netns \
pigz \
xz-utils \
iproute2 \
xfsprogs \
btrfs-progs \
e2fsprogs && \
rm -rf /var/lib/apt/list/*

View File

@ -45,7 +45,7 @@ Pin: release a=unstable
Pin-Priority: 10
EOF
apt-get update
apt-get install -y -t unstable firefox p11-kit-modules
apt-get install -o Dpkg::Options::="--force-confnew" -y -t unstable firefox p11-kit-modules
else
apt-mark unhold firefox || :
apt-get remove firefox

View File

@ -8,8 +8,22 @@ if [ "${ARCH}" == "arm64" ] ; then
exit 0
fi
# Install terraform
curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add -
apt-add-repository "deb [arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
echo \
"deb [arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com $(lsb_release -cs) main" \
> /etc/apt/sources.list.d/hashicorp.list
apt-get update
apt-get install -y terraform
apt-get install -y \
terraform
# Cleanup
chown -R 1000:0 $HOME
find /usr/share/ -name "icon-theme.cache" -exec rm -f {} \;
if [ -z ${SKIP_CLEAN+x} ]; then
apt-get autoclean
rm -rf \
/var/lib/apt/lists/* \
/var/tmp/* \
/tmp/*
fi

View File

@ -48,9 +48,12 @@ Pin-Priority: 1001
fi
# Desktop icon
if [[ "${DISTRO}" == @(fedora37|fedora38|fedora39|fedora40) ]]; then
if [[ "${DISTRO}" == @(fedora37|fedora38|fedora39) ]]; then
cp /usr/share/applications/mozilla-thunderbird.desktop $HOME/Desktop/
chmod +x $HOME/Desktop/mozilla-thunderbird.desktop
elif [[ "${DISTRO}" == "fedora40" ]]; then
cp /usr/share/applications/org.mozilla.thunderbird.desktop $HOME/Desktop/
chmod +x $HOME/Desktop/org.mozilla.thunderbird.desktop
else
cp /usr/share/applications/thunderbird.desktop $HOME/Desktop/
chmod +x $HOME/Desktop/thunderbird.desktop