Commit 32bbf05b authored by Giuliano Taffoni's avatar Giuliano Taffoni
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading

Dockerfile

0 → 100644
+104 −0
Original line number Diff line number Diff line
FROM bscpm/ompss_at_fpga:2.1.0
MAINTAINER Giuliano Taffoni <giuliano.taffoni@inaf.it>
USER root

# Set non-interactive
ENV DEBIAN_FRONTEND noninteractive

# Always update when extending base images
RUN apt update


#------------------------
# Install deps
#------------------------

# Git, Curl, sudo and  Nano
RUN apt-get install git curl sudo nano -y


#----------------------
# Minimal Desktop
#----------------------

# Utilities
RUN mkdir -p /usr/share/man/man1
RUN apt-get install -y telnet unzip wget supervisor build-essential python-dev git-core openjdk-8-jre vim emacs

# Global Supervisord conf
COPY files/supervisord.conf /etc/supervisor/

# Install xvfb that triggers minimal install of X base packages and xterm
RUN apt-get install xvfb xterm  -y

# Install base packages for VNC server and headless desktop (2)
RUN cd /opt && wget https://bintray.com/tigervnc/stable/download_file?file_path=tigervnc-1.8.0.x86_64.tar.gz -O tigervnc-1.8.0.x86_64.tar.gz \
            && tar -zxvf tigervnc-1.8.0.x86_64.tar.gz \
            && mv tigervnc-1.8.0.x86_64 tigervnc

# Supervisord configuration
COPY files/supervisord_vnc.conf /etc/supervisor/conf.d/
COPY files/run_vnc.sh /etc/supervisor/conf.d/
COPY files/run_novnc.sh /etc/supervisor/conf.d/
RUN chmod 755 /etc/supervisor/conf.d/run_vnc.sh
RUN chmod 755 /etc/supervisor/conf.d/run_novnc.sh

# Web VNC (noVNC) v0.6.1.
# NOTE: this is a custom version from Doro Wu (fcwu.tw@gmail.com).
# TODO: Check differences and maybe move to 0.6.2
COPY files/noVNC.tar.gz /usr/lib/
RUN cd /usr/lib/ && tar -zxvf noVNC.tar.gz
COPY files/index.html /usr/lib/noVNC

RUN apt-get install -y net-tools

# Supervisord configuration
COPY files/supervisord_novnc.conf /etc/supervisor/conf.d/

# X environment setup/startup
RUN apt-get install fluxbox -y
COPY files/xstartup /opt/tigervnc/
RUN chmod 755 /opt/tigervnc/xstartup

RUN apt -y update
RUN apt -y upgrade
RUN apt-get -y install firefox-esr cpio libarchive-tools tftp locales-all locales

RUN apt -y install diffstat chrpath socat libtool libtool-bin libtool-doc
RUN apt -y install less
# Prepare for logs
RUN mkdir /home/ompss/.logs && chown ompss:ompss /home/ompss/.logs

# Add fluxbox customisations
COPY files/dot_fluxbox /home/ompss/.fluxbox
RUN chown -R ompss:ompss /home/ompss/.fluxbox
COPY files/background.jpg /usr/share/images/fluxbox/background.jpg

# Rename ompss home folder as a "vanilla" home folder
RUN touch /home/ompss/.initialized
RUN mv /home/ompss /ompss_home_vanilla
RUN rm /ompss_home_vanilla/.initialized
# Give write access to anyone to the home folder so the entrypoint will be able
# to copy over the /home/matauser_vanilla into /home/ompss (for Singularity)
RUN chown ompss.ompss /home/ompss
RUN chmod 777 /home


#----------------------
# Entrypoint
#----------------------

# Copy entrypoint
COPY entrypoint.sh /

# Give right permissions
RUN chmod 755 /entrypoint.sh

# Set entrypoint
ENTRYPOINT ["/entrypoint.sh"]

# Set user ompss
USER ompss

# Set container name
ENV CONTAINER_NAME='ompss_desktop2.1.0'

README.md

0 → 100644
+5 −0
Original line number Diff line number Diff line
# Xilinx metadesktop

Contenerised desktop enviroment to sintetize fpga images with VIVADO and OmpSs@FPGA

entrypoint.sh

0 → 100644
+124 −0
Original line number Diff line number Diff line
#!/bin/bash

# Exit on any error. More complex stuff could be done in future
# (see https://stackoverflow.com/questions/4381618/exit-a-script-on-error)
set -e

GUI=True

if [ "x$SAFE_MODE" == "xTrue" ]; then

    echo ""
    echo "[INFO] Not executing entrypoint as we are in safe mode, just opening a Bash shell."
    exec /bin/bash

else

    echo ""
    echo "[INFO] Executing entrypoint..."
    
    if [ "x$GUI" == "xTrue" ]; then
	    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
    fi
    
    #---------------------
    #   Setup home
    #---------------------

    if [ ! -f "/home/ompss/.initialized" ]; then
        echo "[INFO] Setting up home"
	[ ! -d "/home/ompss" ] &&  mkdir -p /home/ompss
        # Copy over vanilla home contents
        for x in /ompss_home_vanilla/* /ompss_home_vanilla/.[!.]* /ompss_home_vanilla/..?*; do
            if [ -e "$x" ]; then cp -a "$x" /home/ompss/; fi
        done
        
        # Mark as initialized
	[ ! -f "/home/ompss/.initialized" ] && touch /home/ompss/.initialized
    fi
    

    #---------------------
    #   Save env
    #---------------------
    echo "[INFO] Dumping env"
    
    # Save env vars for later usage (e.g. ssh)
    
    env | \
    while read env_var; do
      if [[ $env_var == HOME\=* ]]; then
          : # Skip HOME var
      elif [[ $env_var == PWD\=* ]]; then
          : # Skip PWD var
      else
          echo "export $env_var" >> /tmp/env.sh
      fi
    done
    
    #---------------------
    #   VNC Password
    #---------------------
    if [ "x$GUI" == "xTrue" ]; then
	    if [ "x$AUTH_PASS" != "x" ]; then
	        echo "[INFO] Setting up VNC password..."
	        mkdir -p /home/ompss/.vnc
	        /opt/tigervnc/usr/bin/vncpasswd -f <<< $AUTH_PASS > /home/ompss/.vnc/passwd
	        chmod 600 /home/ompss/.vnc/passwd
	        export VNC_AUTH=True
	    else
	        echo "[INFO] Not setting up any VNC password"
	            
	    fi
    fi
    
	echo "[INFO] Creating /tmp/ompsshome to be used as ompss home"
	mkdir /tmp/ompsshome
	
	echo "[INFO] Initializing /tmp/ompsshome with configuration files"
	cp -aT /ompss_home_vanilla /tmp/ompsshome
	
	echo "[INFO] Moving to /home/ompss and setting as home"
	cd /home/ompss
	export HOME=/home/ompss
	
	echo "[INFO] Setting new prompt @$CONTAINER_NAME container"
	echo 'export PS1="${debian_chroot:+($debian_chroot)}\u@$CONTAINER_NAME@\h:\w\$ "' >> /tmp/ompsshome/.bashrc

	
    # Set entrypoint command
	if [ "x$@" == "x" ]; then
	    if [ "x$GUI" == "xTrue" ]; then
            COMMAND="supervisord -c /etc/supervisor/supervisord.conf"
	    else
	        COMMAND="/bin/bash"
	    fi
	else
	    COMMAND="$@"
	fi
	

    # Start!
	echo -n "[INFO] Will execute entrypoint command: "
	echo $COMMAND
	echo ""
	echo "=============================================================="
	echo ""
	echo "      Welcome to the EUROEXA $CONTAINER_NAME container!"
	echo ""
	echo "=============================================================="
	echo ""
	echo "You are now in /home/ompss with write access as user \"$(whoami)\"."
	echo ""
	echo "Remember that contents inside this container, unless stored"
	echo "on a persistent volume mounted from you host machine, will"
	echo "be wiped out when exiting the container."
	echo ""
	
	exec $COMMAND

fi

files/background.jpg

0 → 100644
+9.96 KiB
Loading image diff...

files/dot_fluxbox/apps

0 → 100644
+4 −0
Original line number Diff line number Diff line
[app] (name=fbrun)
  [Position]	(WINCENTER)	{0 0}
  [Layer]	{2}
[end]