Skip to content
Snippets Groups Projects
Verified Commit c6eac291 authored by David Beniamine's avatar David Beniamine
Browse files

WIP installing base tools

parent 8c6405aa
No related branches found
No related tags found
No related merge requests found
.env
homedir
.*.sw?
services:
kasm:
build:
context: ./
context: ./docker/
target: kasmvnc-base
args:
- SPYDER=${SPYDER}
......@@ -9,10 +9,14 @@ services:
image: "kasmvnc-ubuntu-noble:spyder-${SPYDER}_anaconda-${ANACONDA}"
container_name: KasmVNC-ubuntu
volumes:
- ./homedir:/home/kasm_user:rw
- homedir:/home/:rw
- etc_shadow:/opt/shadow
environment:
- VNC_PW=${PASS}
- SPYDER=${SPYDER}
- ANACONDA=${ANACONDA}
volumes:
homedir:
etc_shadow:
FROM kasmweb/core-ubuntu-noble:1.16.0 as kasmvnc-base
USER root
ENV HOME /home/kasm-default-profile
ENV STARTUPDIR /dockerstartup
ENV INST_SCRIPTS $STARTUPDIR/install
WORKDIR $HOME
######### Customize Container Here ###########
ARG SPYDER
ARG ANACONDA
ARG ANACONDA_VERS=Anaconda3-2024.02-1
USER root
RUN apt-get update
RUN apt-get update && \
apt-get purge -y language-pack-* && \
apt-get -y dist-upgrade && \
apt-get install -y \
firefox \
gnome-system-tools \
inotify-tools \
language-pack-fr \
language-pack-fr-base \
language-pack-en \
language-pack-en-base && \
locale-gen --purge fr_FR.UTF-8 en_US.UTF-8
RUN mkdir /install
WORKDIR /install
......@@ -15,12 +34,24 @@ RUN if [ "$SPYDER" = true ] ; then apt-get install -y python3-spyder; fi
# === Install anaconda === #
RUN if [ "$ANACONDA" = true ] ; then \
wget https://repo.anaconda.com/archive/Anaconda3-2024.02-1-Linux-x86_64.sh; \
bash Anaconda3-2024.02-1-Linux-x86_64.sh -b; \
chmod u+x /home/kasm-user/anaconda3/etc/profile.d/conda.sh; \
wget https://repo.anaconda.com/archive/${ANACONDA_VERS}-Linux-x86_64.sh; \
bash ${ANACONDA_VERS}-Linux-x86_64.sh -b; \
chmod u+x $HOME/anaconda3/etc/profile.d/conda.sh; \
echo "source ~/anaconda3/etc/profile.d/conda.sh" >> /home/kasm-default-profile/.bashrc; \
echo "conda activate" >> /home/kasm-default-profile/.bashrc; \
fi
WORKDIR /home/kasm-user
RUN rm -rf $HOME/.cache
COPY custom_startup.sh $STARTUPDIR/custom_startup.sh
COPY shadow_monitor.sh /
######### End Customizations ###########
RUN chown 1000:0 $HOME
ENV HOME /home/kasm-user
WORKDIR $HOME
RUN mkdir -p $HOME && chown -R 1000:0 $HOME
USER 1000
#!/bin/bash
VNC_USER=kasm-user
sed -i -e "s@kasm-default-profile@$VNC_USER@g" ~/anaconda3/etc/profile.d/conda.sh
# Add changepassword icon
mkdir -p /home/$VNC_USER/Desktop
cat <<EOF > /home/$VNC_USER/Desktop/users.desktop
[Desktop Entry]
Type=Link
Name=Change password
Icon=config-users
URL=/usr/share/applications/users.desktop
terminal=true
EOF
if [ $ANACONDA == 'true' ]; then
cat <<eof > /home/$VNC_USER/Desktop/anaconda.desktop
[Desktop Entry]
Type=Application
Name=Anaconda
Terminal=true
Icon=/home/$VNC_USER/anaconda3/lib/python3.8/site-packages/anaconda_navigator/static/images/anaconda.png
Exec=/home/$VNC_USER/anaconda3/bin/anaconda-navigator
eof
fi
if [ $SPYDER == 'true' ]; then
cat <<eof > /home/$VNC_USER/Desktop/spyder.desktop
[Desktop Entry]
Type=Application
Name=Spyder
Terminal=true
Icon=/home/$VNC_USER/anaconda3/share/icons/spyder.png
Exec=$(which spyder)
eof
fi
if [ -f "/opt/shadow/shadow" ]
then
echo "Copying shadow file"
cp /opt/shadow/shadow /etc/shadow
sync
fi
/shadow_monitor.sh
#!/bin/bash
sleep 10
while true; do
modif=$(inotifywait --event move /etc)
echo "Modif : '$modif'"
if [ ! -z "$(echo $modif | grep 'MOVED_FROM nshadow')" ]; then
echo "Shadow file has changed"
sync
cp /etc/shadow /opt/shadow/shadow
fi
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment