Skip to content
Commits on Source (22)
FROM sarusso/basicmetadesktop:v0.2.0 FROM basicdesktop
MAINTAINER Stefano Alberto Russo <stefano.russo@gmail.com> MAINTAINER Stefano Alberto Russo <stefano.russo@gmail.com>
# Switch to root user # Switch to root user
......
...@@ -24,6 +24,8 @@ fi ...@@ -24,6 +24,8 @@ fi
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
#xsetroot -solid grey #xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" /bin/bash & xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" /bin/bash &
#python3 /home/metauser/astrocook/ac_gui.py
#twm & #twm &
fluxbox & fluxbox &
FROM ubuntu:20.04
MAINTAINER Stefano Alberto Russo <stefano.russo@inaf.it>
#----------------------
# Basics
#----------------------
# Set non-interactive
ENV DEBIAN_FRONTEND noninteractive
# Update first of all
RUN apt-get update
# Utilities
RUN apt-get install -y nano telnet unzip wget git-core sudo
# Change APT user to allow some container runtimes properly work (i.e. Podman)
RUN groupadd -g 600 _apt
RUN usermod -g 600 _apt
#------------------------
# "Meta" user
#------------------------
# Add group. We chose GID 1000 as default.
RUN groupadd -g 1000 metauser
# Add user. We chose UID 1000 as default
RUN useradd metauser -d /home/metauser -u 1000 -g 1000 -m -s /bin/bash
# Add metuaser user to sudoers
RUN adduser metauser sudo
# No pass sudo (for everyone, actually)
COPY files/sudoers /etc/sudoers
# Prepare for user-space logs
RUN mkdir /home/metauser/.logs && chown metauser:metauser /home/metauser/.logs
# Rename metauser home folder as a "vanilla" home folder
RUN mv /home/metauser /metauser_home_vanilla
# Set container name
ENV CONTAINER_NAME='base'
# Entrypoint
COPY files/base_entrypoint.sh /usr/bin/base_entrypoint.sh
RUN chmod 755 /usr/bin/base_entrypoint.sh
ENTRYPOINT ["/usr/bin/base_entrypoint.sh"]
ENV DEFAULT_ENTRYPOINT_COMMAND="/bin/bash"
# Allow to move the /home_vanilla folder in /home
RUN chmod 777 /home
# Set user
USER metauser
#!/bin/bash
docker build . -t base
...@@ -6,19 +6,17 @@ set -e ...@@ -6,19 +6,17 @@ set -e
if [ "x$SAFE_MODE" == "xTrue" ]; then if [ "x$SAFE_MODE" == "xTrue" ]; then
echo "" echo ""
echo "[INFO] Not executing entrypoint as we are in safe mode, just opening a Bash shell." echo "[INFO] Not executing entrypoint as we are in safe mode, just opening a Bash shell."
exec /bin/bash exec /bin/bash
else else
echo "" echo ""
echo "[INFO] Executing entrypoint..." echo "[INFO] Executing entrypoint..."
if [ "x$BASE_PORT" == "x" ]; then
echo "[INFO] No task base port set, will set noVNC port 8590 and VNC port 5900 with desktop id \"0\""
else
echo "[INFO] Task base port set, will set noVNC port $BASE_PORT and noVNC port $(($BASE_PORT+1)) with desktop id \"$(($BASE_PORT-5900+1))\""
fi
#--------------------- #---------------------
# Setup home # Setup home
#--------------------- #---------------------
...@@ -34,7 +32,7 @@ else ...@@ -34,7 +32,7 @@ else
if [ -e "$x" ]; then cp -a "$x" /home/metauser/; fi if [ -e "$x" ]; then cp -a "$x" /home/metauser/; fi
done done
# Mark as initialized # Mark as initialized
touch /home/metauser/.initialized touch /home/metauser/.initialized
fi fi
...@@ -42,7 +40,8 @@ else ...@@ -42,7 +40,8 @@ else
echo "[INFO] Setting up HOME env var" echo "[INFO] Setting up HOME env var"
export HOME=/home/metauser export HOME=/home/metauser
cd /home/metauser cd /home/metauser
#--------------------- #---------------------
# Save env # Save env
#--------------------- #---------------------
...@@ -61,48 +60,32 @@ else ...@@ -61,48 +60,32 @@ else
fi fi
done done
#---------------------
# Password
#--------------------- #---------------------
# Storage link
if [ "x$AUTH_PASS" != "x" ]; then #---------------------
echo "[INFO] Setting up VNC password..." if [ -e "/storages" ]; then
else echo "[INFO] Creating link from /home/metauser/storages to /storages."
echo "[INFO] Setting up default VNC password (metapassword)" ln -s /storages /home/metauser/storages
AUTH_PASS=metapass fi
fi
/usr/local/bin/kasmvncpasswd -f <<< $AUTH_PASS > /home/metauser/.kasmpasswd
chmod 600 /home/metauser/.kasmpasswd
export VNC_AUTH=True
#--------------------- #---------------------
# User # Prompt
#--------------------- #---------------------
if [ "x$AUTH_USER" != "x" ]; then
echo "[INFO] Setting up VNC user..."
sed -i -e "s/username=metauser/username=$AUTH_USER/" /home/metauser/.vnc/config
else
echo "[INFO] Setting up default VNC user (metauser)"
fi
echo "[INFO] Setting new prompt @$CONTAINER_NAME container" echo "[INFO] Setting new prompt @$CONTAINER_NAME container"
echo 'export PS1="${debian_chroot:+($debian_chroot)}\u@$CONTAINER_NAME@\h:\w\$ "' >> /home/metauser/.bashrc echo 'export PS1="${debian_chroot:+($debian_chroot)}\u@$CONTAINER_NAME@\h:\w\$ "' >> /home/metauser/.bashrc
#--------------------- #---------------------
# Entrypoint command # Entrypoint command
#--------------------- #---------------------
if [ "$@x" == "x" ]; then if [ "$@x" == "x" ]; then
DEFAULT_COMMAND="supervisord -c /etc/supervisor/supervisord.conf"
echo -n "[INFO] Executing default entrypoint command: " echo -n "[INFO] Executing default entrypoint command: "
echo $DEFAULT_COMMAND echo $DEFAULT_ENTRYPOINT_COMMAND
exec $DEFAULT_COMMAND exec $DEFAULT_ENTRYPOINT_COMMAND
else else
echo -n "[INFO] Executing entrypoint command: " echo -n "[INFO] Executing entrypoint command: "
echo $@ echo $@
......
#!/bin/bash
docker run -v$PWD/:/data -it base
FROM minimalmetadesktop FROM minimaldesktop
MAINTAINER Stefano Alberto Russo <stefano.russo@gmail.com> MAINTAINER Stefano Alberto Russo <stefano.russo@inaf.it>
# Switch to root
USER root USER root
# Always start with an apt-get update when extending Reyns images, # Extra for Ubuntu18.04
# otherwise apt repositories might get outdated (404 not found)
# and building without cache does not re-build Reyns services.
RUN apt-get update
# Extra for 18.04
RUN apt-get install net-tools dbus-x11 -y RUN apt-get install net-tools dbus-x11 -y
#---------------------- #----------------------
# Xfce # Xfce
#---------------------- #----------------------
RUN apt-get update RUN apt-get update
RUN apt-get install xfce4 xfce4-terminal mousepad ristretto tumbler firefox -y RUN apt-get install xfce4 xfce4-terminal mousepad ristretto tumbler firefox gnome-flashback -y
# Replace X startup with version that uses Xfce as Window Manager
COPY files/xstartup /opt/tigervnc/
RUN chmod 755 /opt/tigervnc/xstartup
# X startup
COPY files/xstartup /opt/tigervnc/
RUN chmod 755 /opt/tigervnc/xstartup
#---------------------- #----------------------
...@@ -55,7 +41,7 @@ RUN chmod 755 /usr/bin/set_mouse_scrolling_speed ...@@ -55,7 +41,7 @@ RUN chmod 755 /usr/bin/set_mouse_scrolling_speed
RUN chown -R metauser:metauser /metauser_home_vanilla/Desktop/ RUN chown -R metauser:metauser /metauser_home_vanilla/Desktop/
# Shorter bash prompt # Shorter bash prompt
#RUN echo "PS1=\"\u@MetaBox:\W $ \"" >> /metauser_home_vanilla/.bashrc #RUN echo "PS1=\"\u@basicdesktop:\W $ \"" >> /metauser_home_vanilla/.bashrc
# Default conf (mostly eyecandy) # Default conf (mostly eyecandy)
...@@ -73,27 +59,28 @@ RUN chmod 000 /usr/bin/xfce4-session-logout ...@@ -73,27 +59,28 @@ RUN chmod 000 /usr/bin/xfce4-session-logout
# Create Downloads folder. This is "required" for showing proper spacing between icons in the filemanager a bounch # Create Downloads folder. This is "required" for showing proper spacing between icons in the filemanager a bounch
RUN mkdir /metauser_home_vanilla/Downloads && chown metauser:metauser /metauser_home_vanilla/Downloads RUN mkdir /metauser_home_vanilla/Downloads && chown metauser:metauser /metauser_home_vanilla/Downloads
# Extra SW
#----------------------
# Extra SW
#----------------------
RUN sudo apt-get install gdebi-core -y
COPY files/software/dropbox_2015.10.28_amd64.deb /root/
RUN gdebi /root/dropbox_2015.10.28_amd64.deb -n
#RUN apt-get install libreoffice gimp -y #RUN apt-get install libreoffice gimp -y
# Shell for temrinal # Shell for terminal
COPY files/runshell.sh /bin/ COPY files/runshell.sh /bin/
RUN chmod 755 /bin/runshell.sh RUN chmod 755 /bin/runshell.sh
# Set conatiner name for prompt
ENV CONTAINER_NAME='basicmetadesktop'
# Giveagain, since xfce install "fixed" it) write access to anyone to the home folder so the entrypoint #------------------------
# will be able to copy over the /home/matauser_vanilla into /home/metauser (for Singularity) # Post-intall
#------------------------
# Fix home permissions
RUN chmod 777 /home RUN chmod 777 /home
# Switch back to metauser # X environment startup
USER metauser RUN mkdir -p /metauser_home_vanilla/.vnc
COPY files/xstartup /metauser_home_vanilla/.vnc
RUN chmod 755 /metauser_home_vanilla/.vnc/xstartup
# Set user
USER metauser
# Set container name
ENV CONTAINER_NAME='basicdesktop'
#!/bin/bash
docker build . -t basicdesktop